Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def __init__(self):
self.fig = plt.figure(figsize=(3, 2))
matplotlib.rcParams['axes.formatter.useoffset'] = True
# Do not apply scaler norm on following data
self.name_not_scalable = ['r2_adjust', 'r_factor', 'alive', 'dead', 'elapsed_time',
'scaler_alive', 'i0_time', 'time', 'time_diff', 'dwell_time']
self.param_quant_analysis = ParamQuantitativeAnalysis()
self.param_quant_analysis.set_experiment_distance_to_sample(distance_to_sample=0.0)
self.param_quant_analysis.set_experiment_incident_energy(incident_energy=self.incident_energy)
interpolate the result to uniform grid before saving to tiff and txt files
The grid dimensions match the dimensions of positional data for X and Y axes.
The range of axes is chosen to fit the values of X and Y.
data_from : str, optional
where do data come from? Data format includes data from NSLS-II, or 2IDE-APS
dask_client: dask.distributed.Client
Dask client object. If None, then Dask client is created automatically.
If a batch of files is processed, then creating Dask client and
passing the reference to it to the processing functions will save
execution time: `client = Client(processes=True, silence_logs=logging.ERROR)`
"""
fpath = os.path.join(working_directory, file_name)
# Load quantitative calibration files (if necessary)
quant_norm = False # Indicates if at least one calibration file is loaded
param_quant_analysis = ParamQuantitativeAnalysis()
if fln_quant_calib_data:
if isinstance(fln_quant_calib_data, str):
fln_quant_calib_data = [fln_quant_calib_data]
for fln in fln_quant_calib_data:
if os.path.isabs(fln):
f = fln
else:
f = os.path.join(working_directory, fln)
try:
param_quant_analysis.load_entry(f)
quant_norm = True
logger.info(f"Quantitative calibration is loaded successfully from file '{f}'")
except Exception as ex:
logger.error(f"Error occurred while loading quantitative calibration from file '{f}': {ex}")
t0 = time.time()
def _update_qn(self, change):
# Propagate current value of 'self.param_quant_analysis' (activate 'observer' functions)
tmp = self.param_quant_analysis
self.param_quant_analysis = ParamQuantitativeAnalysis()
self.param_quant_analysis = tmp
self.set_low_high_value() # reset low high values based on normalization
self.show_image()
self.update_img_wizard_items()