API reference#

This page provides an auto-generated summary of Pyxel’s API.

Top-level functions#

load(yaml_file)

Load configuration from a YAML file.

run_mode(mode, detector, pipeline[, ...])

Run a pipeline.

run(input_filename[, override, random_seed])

Run a YAML configuration file.

show_versions()

Display the versions of Pyxel and its dependencies.

Configuration#

Configuration(pipeline[, exposure, ...])

Configuration class.

copy_config_file(input_filename, output_dir)

Save a copy of the input YAML file to output directory.

Data structures#

Scene()

Scene class defining and storing information of all multi-wavelength photons (unit: ph / (cm2 nm s)).

Photon(geo)

Photon class designed to handle the storage of monochromatic (unit: ph or multi-wavelength photons (unit ph/nm).

Charge(geo)

Charge class representing charge distribution (unit: e⁻).

Pixel(geo)

Pixel class defining and storing information of charge packets within pixel (unit: e⁻).

Phase(geo)

Phase class.

Signal(geo)

Signal class defining and storing information of detector signal (unit: Volt).

Image(geo)

Image class defining and storing information of detector image (unit: adu).

ArrayBase(shape)

Base Array class.

Detectors#

CCD(geometry, environment, characteristics)

Charge-Coupled Device class containing all detector attributes and data.

CMOS(geometry, environment, characteristics)

CMOS-based detector class containing all detector attributes and data.

MKID(geometry, environment, characteristics)

MKID-based detector class containing all detector attributes and data.

APD(geometry, environment, characteristics)

CMOS-based detector class containing all detector attributes and data.

Detector([environment])

Base class for simulating a generic detector (e.g., CCD, CMOS).

Attributes#

Detector.geometry

Geometrical attributes of the detector (e.g. num of rows, columns...).

Detector.characteristics

Characteristics attributes of the detector (e.g. quantum efficiency...).

Detector.scene

Get the current scene being observed by the detector.

Detector.photon

Get the information of detected photon (in ph or ph/nm).

Detector.charge

Get the charge information of charge distribution (in electron).

Detector.pixel

Get the pixel information of charge packets within pixel (in electron).

Detector.signal

Get the signal information from the detector (in Volt).

Detector.image

Get the image information from the detector (in adu).

Detector.data

Get the structured ata from the detector's processing.

Detector.intermediate

Get the intermediate data used during processing.

Properties#

Environment([temperature, wavelength])

Environmental attributes of the detector.

Characteristics([quantum_efficiency, ...])

Characteristic attributes of the detector.

Geometry(row, col[, total_thickness, ...])

Geometrical attributes of the detector.

ReadoutProperties(times[, start_time, ...])

Readout sampling detector properties related to the readout process of a detector.

CCDGeometry(row, col[, total_thickness, ...])

Geometrical attributes of a CCD detector.

CMOSGeometry(row, col[, total_thickness, ...])

Geometrical attributes of a CMOS-based detector.

MKIDGeometry(row, col[, total_thickness, ...])

Geometrical attributes of a MKID-based detector.

APDCharacteristics(roic_gain[, ...])

Characteristic attributes of the APD detector.

APDGeometry(row, col[, total_thickness, ...])

Geometrical attributes of a APD-based detector.

Readout time#

Detector.set_readout(times[, start_time, ...])

Set readout sampling properties.

Detector.readout_properties

Return current readout sampling properties.

Detector.time

Get the current time within the readout simulation.

Detector.start_time

TBW.

Detector.absolute_time

Get the absolute time relative to the simulation start.

Detector.time_step

Get the step size used for advancing in the simulation.

Detector.times_linear

Check if the time intervals between readout samples are uniform.

Detector.num_steps

Return the total number of readout steps.

Detector.pipeline_count

Get the current readout pipeline count.

Detector.is_first_readout

Check if this is the first readout time.

Detector.is_last_readout

Check if this is the last readout time.

Detector.read_out

Get the status of the readout process.

Detector.is_dynamic

Return if detector is dynamic (time dependent) or not.

Detector.non_destructive_readout

Return if detector readout mode is destructive or integrating.

Detector.has_persistence()

TBW.

Detector.persistence

TBW.

Detector.numbytes

Recursively calculates object size in bytes using Pympler library.

Detector.memory_usage([print_result, ...])

Calculate and return the memory usage of each component of the detector.

IO / Conversion#

Detector.load(filename)

Load a detector object from a filename.

Detector.save(filename)

Save a detector object into a filename.

Detector.from_hdf5(filename)

Load a detector object from a HDF5 file.

Detector.to_hdf5(filename)

Write the detector content to a HDF5 file.

Detector.from_asdf(filename)

Load a detector object from a ASDF file.

Detector.to_asdf(filename)

Write the detector content to a ASDF file.

Detector.to_xarray()

Create a new Dataset from all data containers.

Detector.to_dict()

Convert a Detector to a dict.

Detector.from_dict(dct)

Create a new instance of a Detector from a dict.

Inputs#

load_image(filename)

Load a 2D image.

load_header(filename[, section])

Load and return header information from a file.

load_table(filename[, header, dtype])

Load a table from a file and returns a pandas dataframe.

Fitness functions#

sum_of_abs_residuals(simulated, target, ...)

Calculate the sum of absolute residuals between simulated and target values.

sum_of_squared_residuals(simulated, target, ...)

Calculate the sum of squared residuals between simulated and target values.

reduced_chi_squared(simulated, target, ...)

Compute the reduced chi-square error statistic.

Plotting#

plot_ptc(dataset[, text_base_fontsize, ...])

Plot Photon Transfer Curve (PTC) from a dataset containing 'mean' and 'variance' data.

Notebook#

General#

display_detector(detector, *[, new_display, ...])

Display detector interactively.

display_html(obj)

Display object attributes and their types in a HTML table.

display_scene(detector[, figsize])

Display the scene contained in 'detector' and the size of the detector.

Displaying calibration inputs and outputs#

display_calibration_inputs(calibration, detector)

Display calibration inputs and target data based on configuration file.

display_simulated(ds)

Display simulated and target data from the output dataset.

display_evolution(ds)

Display best champion parameter and overall fitness vs evolution.

optimal_parameters(ds)

Return a dataframe of best parameters.

champion_heatmap(ds[, num_bins, logx, ...])

Plot a heatmap of champion parameters vs fitness.

Utility functions#

download_examples([foldername, force])

Download and save examples from Pyxel Data Gitlab repository in the working directory.

get_size(obj)

Recursively calculates object size in bytes using Pympler library.

memory_usage_details(obj, *attr_kw[, ...])

Calculate the memory usage of an object.

time_pipeline(detector, pipeline)

Time a single pipeline.

fit_into_array(array, output_shape[, ...])

Fit input array into an output array of specified output shape.

Deprecated / Pending deprecation#

exposure_mode(exposure, detector, pipeline)

Run an 'exposure' pipeline.

observation_mode(observation, detector, pipeline)

Run an 'observation' pipeline.

calibration_mode(calibration, detector, pipeline)

Run a 'calibration' pipeline.

Advanced API#

Pipelines#

DetectionPipeline([scene_generation, ...])

Represent a pipeline of detection models organized into different groups.

Processor(detector, pipeline[, observation_mode])

Represent a processor that execute pipeline.

ModelGroup(models, name)

Manage a collection of model functions.

ModelFunction(func, name[, arguments, enabled])

Create a wrapper function around a Model function.

Exposure#

Exposure(readout[, outputs, result_type, ...])

TBW.

Observation#

Observation(parameters[, outputs, readout, ...])

Observation class.

Calibration#

Calibration(target_data_path, ...[, ...])

TBW.

CalibrationResult(dataset, processors, logs, ...)

Result class for calibration class.

MyArchipelago(**kwargs)

User-defined Archipelago.

Algorithm([type, generations, ...])

TBW.

Outputs#

ExposureOutputs(output_folder[, ...])

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

ObservationOutputs(output_folder[, ...])

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

CalibrationOutputs(output_folder[, ...])

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