MCPcopy Create free account
hub / github.com/NSLS2/PyXRF / output_data_to_tiff

Function output_data_to_tiff

pyxrf/model/fileio.py:1295–1447  ·  view source on GitHub ↗

Read data in memory and save them into tiff to txt. Parameters ---------- fit_output: dict of fitting data and scaler data output_dir : str, optional which folder to save those txt file file_format : str, optional tiff or txt name_prefix_detector

(
    fit_output,
    output_dir=None,
    file_format="tiff",
    name_prefix_detector=None,
    name_append=None,
    scaler_name=None,
    scaler_name_list=None,
    quant_norm=False,
    quant_ref_eline="",
    param_quant_analysis=None,
    use_average=False,
)

Source from the content-addressed store, hash-verified

1293
1294
1295def output_data_to_tiff(
1296 fit_output,
1297 output_dir=None,
1298 file_format="tiff",
1299 name_prefix_detector=None,
1300 name_append=None,
1301 scaler_name=None,
1302 scaler_name_list=None,
1303 quant_norm=False,
1304 quant_ref_eline="",
1305 param_quant_analysis=None,
1306 use_average=False,
1307):
1308 """
1309 Read data in memory and save them into tiff to txt.
1310
1311 Parameters
1312 ----------
1313 fit_output:
1314 dict of fitting data and scaler data
1315 output_dir : str, optional
1316 which folder to save those txt file
1317 file_format : str, optional
1318 tiff or txt
1319 name_prefix_detector : str
1320 prefix appended to file name except for the files that contain positional data and scalers
1321 name_append: str, optional
1322 more information saved to output file name
1323 scaler_name : str, optional
1324 if given, normalization will be performed.
1325 scaler_name_list : list(str)
1326 The list of names of scalers that may exist in the dataset 'dataset_dict'
1327 quant_norm : bool
1328 True - apply quantitative normalization, False - use normalization by scaler
1329 quant_ref_eline: str
1330 Reference emission line for quantitative calibration, e.g. 'Cu_K'. Apply quantitative
1331 normalization only to the lines with existing calibration data if ``quant_ref_eline=""``
1332 (emtpy string, default).
1333 param_quant_analysis : ParamQuantitativeAnalysis
1334 reference to class, which contains parameters for quantitative normalization,
1335 if None, then quantitative normalization will be skipped
1336 use_average : Bool, optional
1337 when normalization, multiply by the mean value of scaler,
1338 i.e., norm_data = data/scaler * np.mean(scaler)
1339 """
1340
1341 if output_dir is None:
1342 raise ValueError("Output directory is not specified.")
1343
1344 if name_append:
1345 name_append = f"_{name_append}"
1346 else:
1347 # If 'name_append' is None, set it to "" so that it could be safely appended to a string
1348 name_append = ""
1349
1350 file_format = file_format.lower()
1351
1352 allowed_formats = ("txt", "tiff")

Callers 1

output_dataFunction · 0.85

Calls 4

_save_dataFunction · 0.85
normalize_data_by_scalerFunction · 0.85
itemsMethod · 0.80

Tested by

no test coverage detected