Outputs

Contents

Outputs#

class pyxel.outputs.ExposureOutputs(output_folder, custom_dir_name='', save_data_to_file=None, save_exposure_data=None)[source]#

Bases: Outputs

Collection of methods to save the data buckets from a Detector for an Exposure pipeline.

Parameters:
  • output_folder (str or Path) – Folder where sub-folder(s) that will be created to save data buckets.

  • custom_dir_name (str, optional) – Prefix of the sub-folder name that will be created in the ‘output_folder’ folder. The default prefix is run_.

  • save_data_to_file (Dict) – Dictionary where key is a ‘data bucket’ name (e.g. ‘detector.photon.array’) and value is the data format (e.g. ‘fits’).

    Example: {‘detector.photon.array’: ‘fits’, ‘detector.charge.array’: ‘hdf’, ‘detector.image.array’:’png’}

save_exposure_outputs(dataset)[source]#

Save the observation outputs such as the dataset.

Parameters:

dataset (Dataset)

build_filenames(filename_suffix=None)#

Generate a list of output filename(s).

Examples

>>> output = Outputs(
...     output_folder="output",
...     save_data_to_file=[
...         {"detector.photon.array": ["fits", "hdf"]},
...         {"detector.charge.array": ["png"]},
...     ],
... )
>>> output.build_filenames()
[Path('detector_photon.fits'), Path('detector_photon.hdf'),  Path('detector_charge.png')]
count_files_to_save()#

Count number of file(s) to be saved.

create_output_folder()#

Create the output folder.

property current_output_folder#

Get directory where all outputs are saved.

property custom_dir_name#
property output_folder#
save_to_csv(data, name, with_auto_suffix=True, run_number=None)#

Write Pandas Dataframe or Numpy array to a CSV file.

save_to_file(processor, prefix=None, with_auto_suffix=True, run_number=None)#
save_to_fits(data, name, with_auto_suffix=True, run_number=None, header=None)#

Write array to FITS file.

save_to_hdf(data, name, with_auto_suffix=True, run_number=None)#

Write detector object to HDF5 file.

save_to_jpeg(data, name, with_auto_suffix=True, run_number=None)#

Write Numpy array to a JPEG image file.

save_to_jpg(data, name, with_auto_suffix=True, run_number=None)#

Write Numpy array to a JPG image file.

save_to_netcdf(data, name, with_auto_suffix=False)#

Write Xarray dataset to NetCDF file.

Parameters:
Returns:

filename (Path)

save_to_npy(data, name, with_auto_suffix=True, run_number=None)#

Write Numpy array to Numpy binary npy file.

save_to_png(data, name, with_auto_suffix=True, run_number=None)#

Write Numpy array to a PNG image file.

save_to_txt(data, name, with_auto_suffix=True, run_number=None)#

Write data to txt file.

class pyxel.outputs.ObservationOutputs(output_folder, custom_dir_name='', save_data_to_file=None, save_observation_data=None)[source]#

Bases: Outputs

Collection of methods to save the data buckets from a Detector for an Observation pipeline.

Parameters:
  • output_folder (str or Path) – Folder where sub-folder(s) that will be created to save data buckets.

  • custom_dir_name (str, optional) – Prefix of the sub-folder name that will be created in the ‘output_folder’ folder. The default prefix is run_.

  • save_data_to_file (Dict) – Dictionary where key is a ‘data bucket’ name (e.g. ‘detector.photon.array’) and value is the data format (e.g. ‘fits’).

    Example: {‘detector.photon.array’: [‘fits’], ‘detector.charge.array’: [‘hdf’], ‘detector.image.array’:[‘png’]}

property save_observation_data#
build_filenames(filename_suffix=None)#

Generate a list of output filename(s).

Examples

>>> output = Outputs(
...     output_folder="output",
...     save_data_to_file=[
...         {"detector.photon.array": ["fits", "hdf"]},
...         {"detector.charge.array": ["png"]},
...     ],
... )
>>> output.build_filenames()
[Path('detector_photon.fits'), Path('detector_photon.hdf'),  Path('detector_charge.png')]
count_files_to_save()#

Count number of file(s) to be saved.

create_output_folder()#

Create the output folder.

property current_output_folder#

Get directory where all outputs are saved.

property custom_dir_name#
property output_folder#
save_to_csv(data, name, with_auto_suffix=True, run_number=None)#

Write Pandas Dataframe or Numpy array to a CSV file.

save_to_file(processor, prefix=None, with_auto_suffix=True, run_number=None)#
save_to_fits(data, name, with_auto_suffix=True, run_number=None, header=None)#

Write array to FITS file.

save_to_hdf(data, name, with_auto_suffix=True, run_number=None)#

Write detector object to HDF5 file.

save_to_jpeg(data, name, with_auto_suffix=True, run_number=None)#

Write Numpy array to a JPEG image file.

save_to_jpg(data, name, with_auto_suffix=True, run_number=None)#

Write Numpy array to a JPG image file.

save_to_netcdf(data, name, with_auto_suffix=False)#

Write Xarray dataset to NetCDF file.

Parameters:
Returns:

filename (Path)

save_to_npy(data, name, with_auto_suffix=True, run_number=None)#

Write Numpy array to Numpy binary npy file.

save_to_png(data, name, with_auto_suffix=True, run_number=None)#

Write Numpy array to a PNG image file.

save_to_txt(data, name, with_auto_suffix=True, run_number=None)#

Write data to txt file.

class pyxel.outputs.CalibrationOutputs(output_folder, custom_dir_name='', save_data_to_file=None, save_calibration_data=None)[source]#

Bases: Outputs

Collection of methods to save the data buckets from a Detector for a Calibration pipeline.

Parameters:
  • output_folder (str or Path) – Folder where sub-folder(s) that will be created to save data buckets.

  • custom_dir_name (str, optional) – Prefix of the sub-folder name that will be created in the ‘output_folder’ folder. The default prefix is run_.

  • save_data_to_file (Dict) – Dictionary where key is a ‘data bucket’ name (e.g. ‘detector.photon.array’) and value is the data format (e.g. ‘fits’).

    Example: {‘detector.photon.array’: ‘fits’, ‘detector.charge.array’: ‘hdf’, ‘detector.image.array’:’png’}

build_filenames(filename_suffix=None)#

Generate a list of output filename(s).

Examples

>>> output = Outputs(
...     output_folder="output",
...     save_data_to_file=[
...         {"detector.photon.array": ["fits", "hdf"]},
...         {"detector.charge.array": ["png"]},
...     ],
... )
>>> output.build_filenames()
[Path('detector_photon.fits'), Path('detector_photon.hdf'),  Path('detector_charge.png')]
count_files_to_save()#

Count number of file(s) to be saved.

create_output_folder()#

Create the output folder.

property current_output_folder#

Get directory where all outputs are saved.

property custom_dir_name#
property output_folder#
save_to_csv(data, name, with_auto_suffix=True, run_number=None)#

Write Pandas Dataframe or Numpy array to a CSV file.

save_to_file(processor, prefix=None, with_auto_suffix=True, run_number=None)#
save_to_fits(data, name, with_auto_suffix=True, run_number=None, header=None)#

Write array to FITS file.

save_to_hdf(data, name, with_auto_suffix=True, run_number=None)#

Write detector object to HDF5 file.

save_to_jpeg(data, name, with_auto_suffix=True, run_number=None)#

Write Numpy array to a JPEG image file.

save_to_jpg(data, name, with_auto_suffix=True, run_number=None)#

Write Numpy array to a JPG image file.

save_to_netcdf(data, name, with_auto_suffix=False)#

Write Xarray dataset to NetCDF file.

Parameters:
Returns:

filename (Path)

save_to_npy(data, name, with_auto_suffix=True, run_number=None)#

Write Numpy array to Numpy binary npy file.

save_to_png(data, name, with_auto_suffix=True, run_number=None)#

Write Numpy array to a PNG image file.

save_to_txt(data, name, with_auto_suffix=True, run_number=None)#

Write data to txt file.