pyAPIC package
pyAPIC public API.
- class pyAPIC.Case(data: ImagingData, params: ReconParams, _result: dict | None = None)[source]
Bases:
objectEncapsulates a reconstruction case: data, parameters, and results.
- data: ImagingData
- classmethod from_mat(mat_path: str, params: ReconParams, downsample: int = 1) Case[source]
Create a Case by loading imaging data from a .mat file and assigning parameters.
- Parameters:
mat_path (str) – Path to the .mat file (HDF5 based).
params (ReconParams) – Reconstruction parameters.
downsample (int) – Factor to subsample the LED stack.
- Returns:
Initialized Case object (results empty until run()).
- Return type:
- params: ReconParams
- plot_E_stack(ncols: int = 5) None[source]
Plot the LED stack as a grid of images.
- Parameters:
ncols (int) – Number of columns in the grid.
- plot_input(ncols: int = 5) None[source]
Plot the initial intensity stack as a grid of images.
- Parameters:
ncols (int) – Number of columns in the grid.
- property result: dict
Retrieve reconstruction outputs. Raises if run() has not been called.
- class pyAPIC.ImagingData(I_low: ndarray, illum_px: ndarray, system_na_px: float, pixel_size: float | None = None, magnification: float | None = None, illum_na: ndarray | None = None, system_na: float | None = None, wavelength: float | None = None)[source]
Bases:
objectContainer for imaging data and acquisition parameters.
- I_low: ndarray
- property dpix_c: float | None
- property freqXY_calib: ndarray
- illum_na: ndarray | None = None
- illum_px: ndarray
- property mag: float | None
- magnification: float | None = None
- property na_cal: float | None
- property na_calib: ndarray | None
- property na_rp_cal: float
- pixel_size: float | None = None
- system_na: float | None = None
- system_na_px: float
- wavelength: float | None = None
- class pyAPIC.ReconParams(reconstruct_aberration: bool = False, stitch_method: str = 'average')[source]
Bases:
objectParameters for phase reconstruction.
- reconstruct_aberration
Whether to perform aberration reconstruction.
- Type:
bool
- stitch_method
Method used to stitch the Fourier patches (“average” or “nearest”).
- Type:
str
- reconstruct_aberration: bool = False
- stitch_method: str = 'average'
- pyAPIC.load_mat(path: str, downsample: int = 1) ImagingData[source]
Load imaging data and calibration parameters from a MATLAB .mat file (v7.3/HDF5).
- Parameters:
path (str) – Path to the .mat file.
downsample (int) – Factor by which to subsample the image stack along the illumination axis.
- Returns:
Populated dataclass.
- Return type:
- pyAPIC.to_pixel_coords(angles: ndarray, *, system_na_px: float, system_na: float | None = None, center: ndarray, wavelength: float | None = None, units: str = 'na', na_cal: float | None = None) ndarray[source]
Convert illumination angles to the
illum_pxpixel coordinates.- Parameters:
angles – Array of illumination angles of shape
(2, N).system_na_px – System numerical aperture expressed in pixel units.
system_na – System numerical aperture (unitless).
na_calmay be used as an alias for backward compatibility.center – Image center
(y, x).wavelength – Illumination wavelength. Required when
units='na'.units – Either
'na'forn sin( heta)or'freq'for spatial frequency units.