@@ -34,6 +34,7 @@ class Analyser(Observer):
3434 def __init__ (
3535 self ,
3636 basepath_local : Path ,
37+ token : str ,
3738 environment : MurfeyInstanceEnvironment | None = None ,
3839 force_mdoc_metadata : bool = False ,
3940 limited : bool = False ,
@@ -49,6 +50,7 @@ def __init__(
4950 self ._batch_store : dict = {}
5051 self ._environment = environment
5152 self ._force_mdoc_metadata = force_mdoc_metadata
53+ self ._token = token
5254 self .parameters_model : (
5355 Type [ProcessingParametersSPA ] | Type [ProcessingParametersTomo ] | None
5456 ) = None
@@ -123,32 +125,34 @@ def _find_context(self, file_path: Path) -> bool:
123125 # CLEM workflow checks
124126 # Look for LIF and XLIF files
125127 if file_path .suffix in (".lif" , ".xlif" ):
126- self ._context = CLEMContext ("leica" , self ._basepath )
128+ self ._context = CLEMContext ("leica" , self ._basepath , self . _token )
127129 return True
128130 # Look for TIFF files associated with CLEM workflow
129131 # Leica's autosave mode seems to name the TIFFs in the format
130132 # PostionXX--ZXX--CXX.tif
131133 if all (
132134 pattern in file_path .name for pattern in ("--Z" , "--C" )
133135 ) and file_path .suffix in (".tiff" , ".tif" ):
134- self ._context = CLEMContext ("leica" , self ._basepath )
136+ self ._context = CLEMContext ("leica" , self ._basepath , self . _token )
135137 return True
136138
137139 # Tomography and SPA workflow checks
138140 if "atlas" in file_path .parts :
139- self ._context = AtlasContext ("epu" , self ._basepath )
141+ self ._context = AtlasContext ("epu" , self ._basepath , self . _token )
140142 return True
141143
142144 if "Metadata" in file_path .parts or file_path .name == "EpuSession.dm" :
143- self ._context = SPAMetadataContext ("epu" , self ._basepath )
145+ self ._context = SPAMetadataContext ("epu" , self ._basepath , self . _token )
144146 return True
145147 elif (
146148 "Batch" in file_path .parts
147149 or "SearchMaps" in file_path .parts
148150 or "Thumbnails" in file_path .parts
149151 or file_path .name == "Session.dm"
150152 ):
151- self ._context = TomographyMetadataContext ("tomo" , self ._basepath )
153+ self ._context = TomographyMetadataContext (
154+ "tomo" , self ._basepath , self ._token
155+ )
152156 return True
153157
154158 split_file_stem = file_path .stem .split ("_" )
@@ -164,7 +168,9 @@ def _find_context(self, file_path: Path) -> bool:
164168 ]:
165169 if not self ._context :
166170 logger .info ("Acquisition software: EPU" )
167- self ._context = SPAModularContext ("epu" , self ._basepath )
171+ self ._context = SPAModularContext (
172+ "epu" , self ._basepath , self ._token
173+ )
168174 self .parameters_model = ProcessingParametersSPA
169175 return True
170176
@@ -178,7 +184,9 @@ def _find_context(self, file_path: Path) -> bool:
178184 ):
179185 if not self ._context :
180186 logger .info ("Acquisition software: tomo" )
181- self ._context = TomographyContext ("tomo" , self ._basepath )
187+ self ._context = TomographyContext (
188+ "tomo" , self ._basepath , self ._token
189+ )
182190 self .parameters_model = ProcessingParametersTomo
183191 return True
184192 return False
@@ -213,14 +221,18 @@ def _analyse(self):
213221 or transferred_file .name == "EpuSession.dm"
214222 and not self ._context
215223 ):
216- self ._context = SPAMetadataContext ("epu" , self ._basepath )
224+ self ._context = SPAMetadataContext (
225+ "epu" , self ._basepath , self ._token
226+ )
217227 elif (
218228 "Batch" in transferred_file .parts
219229 or "SearchMaps" in transferred_file .parts
220230 or transferred_file .name == "Session.dm"
221231 and not self ._context
222232 ):
223- self ._context = TomographyMetadataContext ("tomo" , self ._basepath )
233+ self ._context = TomographyMetadataContext (
234+ "tomo" , self ._basepath , self ._token
235+ )
224236 self .post_transfer (transferred_file )
225237 else :
226238 dc_metadata = {}
0 commit comments