def saveCurrentFieldValues(args, previous_field_values: Dict, current_field_values_file_path: str): """ write the current ui values to prev_run_values_file_path """ field_values = previous_field_values if args.actions == 'Tracking': field_values['tracking_video_dir'] = args.tracking_video_dir field_values[ 'tracking_horizontal_contraction_direction'] = args.tracking_horizontal_contraction_direction field_values[ 'tracking_vertical_contraction_direction'] = args.tracking_vertical_contraction_direction field_values['tracking_template_path'] = args.tracking_template_path field_values['tracking_output_path'] = args.tracking_output_path field_values['tracking_output_frames'] = args.tracking_output_frames field_values[ 'tracking_guide_match_search_seconds'] = args.tracking_guide_match_search_seconds field_values[ 'tracking_max_translation_per_frame'] = args.tracking_max_translation_per_frame field_values[ 'tracking_max_rotation_per_frame'] = args.tracking_max_rotation_per_frame field_values[ 'tracking_output_conversion_factor'] = args.tracking_output_conversion_factor field_values[ 'tracking_microns_per_pixel'] = args.tracking_microns_per_pixel field_values[ 'tracking_sub_pixel_search_increment'] = args.tracking_sub_pixel_search_increment field_values[ 'tracking_sub_pixel_refinement_radius'] = args.tracking_sub_pixel_refinement_radius elif args.actions == 'Morphology': field_values[ 'morphology_search_image_path'] = args.morphology_search_image_path field_values[ 'morphology_left_template_image_path'] = args.morphology_left_template_image_path field_values[ 'morphology_right_template_image_path'] = args.morphology_right_template_image_path field_values[ 'morphology_template_refinement_radius'] = args.morphology_template_refinement_radius field_values[ 'morphology_edge_finding_smoothing_radius'] = args.morphology_edge_finding_smoothing_radius field_values[ 'morphology_microns_per_pixel'] = args.morphology_microns_per_pixel field_values[ 'morphology_sub_pixel_search_increment'] = args.morphology_sub_pixel_search_increment field_values[ 'morphology_sub_pixel_refinement_radius'] = args.morphology_sub_pixel_refinement_radius elif args.actions == 'Ca2+_Analysis': field_values[ 'ca2_analysis_path_to_data'] = args.ca2_analysis_path_to_data field_values[ 'ca2_analysis_expected_frequency_hz'] = args.ca2_analysis_expected_frequency_hz field_values[ 'ca2_analysis_save_result_plots'] = args.ca2_analysis_save_result_plots field_values[ 'ca2_analysis_bg_subtraction_method'] = args.ca2_analysis_bg_subtraction_method with open(current_field_values_file_path, 'w') as outfile: writeJSON(field_values, outfile, indent=4)
if options.crab: ########## ## CRAB ## ########## if options.runInteractive: raise RuntimeError( "This job cannot be run interactively, but rather by crab. Please call without the '--runInteractive' flag or increase the '--maxEventsInteractive' value." ) runsAndLumis = [(event.run, event.lumi) for event in eventList] json = LumiList(lumis=runsAndLumis) eventsToProcess = '\n'.join(\ sorted( [ "%d:%d" % (event.run, event.event) for event in eventList ] ) ) crabDict = setupCrabDict(options) json.writeJSON(crabDict['json']) target = open(crabDict['runEvent'], 'w') target.write("%s\n" % eventsToProcess) target.close() target = open(crabDict['crabcfg'], 'w') target.write(crabTemplate % crabDict) target.close print( "Please visit CRAB twiki for instructions on how to setup environment for CRAB:\nhttps://twiki.cern.ch/twiki/bin/viewauth/CMS/SWGuideCrab\n" ) if options.crabCondor: print( "You are running on condor. Please make sure you have read instructions on\nhttps://twiki.cern.ch/twiki/bin/view/CMS/CRABonLPCCAF\n" ) if not os.path.exists('%s/.profile' % os.environ.get('HOME')): print(
if len (eventList) > options.maxEventsInteractive: options.crab = True if options.crab: ########## ## CRAB ## ########## if options.runInteractive: raise RuntimeError("This job cannot be run interactively, but rather by crab. Please call without the '--runInteractive' flag or increase the '--maxEventsInteractive' value.") runsAndLumis = [ (event.run, event.lumi) for event in eventList] json = LumiList (lumis = runsAndLumis) eventsToProcess = '\n'.join(\ sorted( [ "%d:%d" % (event.run, event.event) for event in eventList ] ) ) crabDict = setupCrabDict (options) json.writeJSON (crabDict['json']) target = open (crabDict['runEvent'], 'w') target.write ("%s\n" % eventsToProcess) target.close() target = open (crabDict['crabcfg'], 'w') target.write (crabTemplate % crabDict) target.close print "Please visit CRAB twiki for instructions on how to setup environment for CRAB:\nhttps://twiki.cern.ch/twiki/bin/viewauth/CMS/SWGuideCrab\n" if options.crabCondor: print "You are running on condor. Please make sure you have read instructions on\nhttps://twiki.cern.ch/twiki/bin/view/CMS/CRABonLPCCAF\n" if not os.path.exists ('%s/.profile' % os.environ.get('HOME')): print "** WARNING: ** You are missing ~/.profile file. Please see CRABonLPCCAF instructions above.\n" print "Setup your environment for CRAB and edit %(crabcfg)s to make any desired changed. Then run:\n\ncrab submit -c %(crabcfg)s\n" % crabDict else:
def ensureDefaultFieldValuesExist(prev_run_values_file_path: str): if Path(prev_run_values_file_path).is_file(): return with open(prev_run_values_file_path, 'w') as outfile: writeJSON(defaultFieldValues(), outfile, indent=4)
if len(eventList) > options.maxEventsInteractive: options.crab = True if options.crab: ########## ## CRAB ## ########## if options.runInteractive: raise RuntimeError, "This job cannot be run interactively, but rather by crab. Please call without the '--runInteractive' flag or increase the '--maxEventsInteractive' value." runsAndLumis = [(event.run, event.lumi) for event in eventList] json = LumiList(lumis=runsAndLumis) eventsToProcess = "\n".join(sorted(["%d:%d" % (event.run, event.event) for event in eventList])) crabDict = setupCrabDict(options) json.writeJSON(crabDict["json"]) target = open(crabDict["runEvent"], "w") target.write("%s\n" % eventsToProcess) target.close() target = open(crabDict["crabcfg"], "w") target.write(crabTemplate % crabDict) target.close print "Please visit CRAB twiki for instructions on how to setup environment for CRAB:\nhttps://twiki.cern.ch/twiki/bin/viewauth/CMS/SWGuideCrab\n" if options.crabCondor: print "You are running on condor. Please make sure you have read instructions on\nhttps://twiki.cern.ch/twiki/bin/view/CMS/CRABonLPCCAF\n" if not os.path.exists("%s/.profile" % os.environ.get("HOME")): print "** WARNING: ** You are missing ~/.profile file. Please see CRABonLPCCAF instructions above.\n" print "Setup your environment for CRAB and edit %(crabcfg)s to make any desired changed. Then run:\n\ncrab submit -c %(crabcfg)s\n" % crabDict else: