@@ -366,16 +366,9 @@ def _start_dc(self, json, from_form: bool = False):
366366 f"{ self ._environment .url .geturl ()} /clients/{ self ._environment .client_id } /tomography_processing_parameters" ,
367367 json = json ,
368368 )
369+
369370 source = Path (json ["source" ])
370- self ._environment .listeners ["data_collection_group_ids" ] = {
371- context ._flush_data_collections
372- }
373- self ._environment .listeners ["data_collection_ids" ] = {
374- context ._flush_processing_job
375- }
376- self ._environment .listeners ["autoproc_program_ids" ] = {
377- context ._flush_preprocess
378- }
371+
379372 self ._environment .id_tag_registry ["data_collection_group" ].append (
380373 str (source )
381374 )
@@ -386,12 +379,85 @@ def _start_dc(self, json, from_form: bool = False):
386379 "tag" : str (source ),
387380 }
388381 requests .post (url , json = dcg_data )
382+
383+ data = {
384+ "voltage" : json ["voltage" ],
385+ "pixel_size_on_image" : json ["pixel_size_on_image" ],
386+ "experiment_type" : json ["experiment_type" ],
387+ "image_size_x" : json ["image_size_x" ],
388+ "image_size_y" : json ["image_size_y" ],
389+ "file_extension" : json ["file_extension" ],
390+ "acquisition_software" : json ["acquisition_software" ],
391+ "image_directory" : str (self ._environment .default_destinations [source ]),
392+ "tag" : json ["tilt_series_tag" ],
393+ "source" : str (source ),
394+ "magnification" : json ["magnification" ],
395+ "total_exposed_dose" : json .get ("total_exposed_dose" ),
396+ "c2aperture" : json .get ("c2aperture" ),
397+ "exposure_time" : json .get ("exposure_time" ),
398+ "slit_width" : json .get ("slit_width" ),
399+ "phase_plate" : json .get ("phase_plate" , False ),
400+ }
401+ capture_post (
402+ f"{ str (self ._environment .url .geturl ())} /visits/{ str (self ._environment .visit )} /{ self ._environment .murfey_session } /start_data_collection" ,
403+ json = data ,
404+ )
405+ for recipe in ("em-tomo-preprocess" , "em-tomo-align" ):
406+ capture_post (
407+ f"{ str (self ._environment .url .geturl ())} /visits/{ str (self ._environment .visit )} /{ self ._environment .murfey_session } /register_processing_job" ,
408+ json = {
409+ "tag" : json ["tilt_series_tag" ],
410+ "source" : str (source ),
411+ "recipe" : recipe ,
412+ },
413+ )
414+ log .info ("Registering tomography processing parameters" )
415+ if self ._environment .data_collection_parameters .get ("num_eer_frames" ):
416+ eer_response = requests .post (
417+ f"{ str (self ._environment .url .geturl ())} /visits/{ self ._environment .visit } /{ self ._environment .murfey_session } /eer_fractionation_file" ,
418+ json = {
419+ "num_frames" : self ._environment .data_collection_parameters [
420+ "num_eer_frames"
421+ ],
422+ "fractionation" : self ._environment .data_collection_parameters [
423+ "eer_fractionation"
424+ ],
425+ "dose_per_frame" : self ._environment .data_collection_parameters [
426+ "dose_per_frame"
427+ ],
428+ "fractionation_file_name" : "eer_fractionation_tomo.txt" ,
429+ },
430+ )
431+ eer_fractionation_file = eer_response .json ()["eer_fractionation_file" ]
432+ json .update ({"eer_fractionation_file" : eer_fractionation_file })
433+ requests .post (
434+ f"{ self ._environment .url .geturl ()} /sessions/{ self ._environment .murfey_session } /tomography_preprocessing_parameters" ,
435+ json = json ,
436+ )
437+ context ._flush_data_collections ()
438+ context ._flush_processing_jobs ()
439+ capture_post (
440+ f"{ self ._environment .url .geturl ()} /visits/{ self ._environment .visit } /{ self ._environment .murfey_session } /flush_tomography_processing" ,
441+ json = {"rsync_source" : str (source )},
442+ )
443+ log .info ("tomography processing flushed" )
444+
389445 elif isinstance (context , SPAContext ) or isinstance (context , SPAModularContext ):
390446 url = f"{ str (self ._environment .url .geturl ())} /visits/{ str (self ._environment .visit )} /{ self .session_id } /register_data_collection_group"
391447 dcg_data = {
392448 "experiment_type" : "single particle" ,
393449 "experiment_type_id" : 37 ,
394450 "tag" : str (source ),
451+ "atlas" : (
452+ str (self ._environment .samples [source ].atlas )
453+ if self ._environment .samples .get (source )
454+ else ""
455+ ),
456+ "sample" : (
457+ self ._environment .samples [source ].sample
458+ if self ._environment .samples .get (source )
459+ else None
460+ ),
395461 }
396462 capture_post (url , json = dcg_data )
397463 if from_form :
0 commit comments