Contrast Curves#
4S is fully compatible with applefy. The following wrapper class can be used to compute detection limits using the applefy package. Since the calculation of the residuals with 4S is quite time-consuming, it is recommended to use a computer cluster for this task. Once all residuals are computed, the detection limits can be calculated in a few minutes (restoring residuals, more details in the applefy documentation).
- class fours.detection_limits.applefy_wrapper.CADIDataReduction(*args, **kwargs)#
Bases:
DataReductionInterfaceWrapper for the cADI algorithm. This is a simple wrapper around the cADI algorithm, which is implemented in the fours package. The wrapper is used to make the cADI algorithm compatible with the applefy framework.
- __call__(stack_with_fake_planet, parang_rad, psf_template, exp_id)#
Call self as a function.
- class fours.detection_limits.applefy_wrapper.CADIDataReductionGPU(*args: Any, **kwargs: Any)#
Bases:
DataReductionInterfaceWrapper for the cADI algorithm. This is a simple wrapper around the cADI algorithm, which is implemented in the fours package. The wrapper is used to make the cADI algorithm compatible with the applefy framework.
This is the GPU version of the cADI algorithm.
- __init__(device)#
- __call__(stack_with_fake_planet, parang_rad, psf_template, exp_id)#
Call self as a function.
- class fours.detection_limits.applefy_wrapper.PCADataReductionGPU(pca_numbers, approx_svd, work_dir=None, special_name=None, device='cpu', verbose=False)#
Bases:
DataReductionInterfaceWrapper for the PCA algorithm. This is a simple wrapper around the PCA algorithm, which is implemented in the fours package. The wrapper is used to make the PCA algorithm compatible with the applefy framework.
This is the GPU version of the PCA algorithm.
- __init__(pca_numbers, approx_svd, work_dir=None, special_name=None, device='cpu', verbose=False)#
Initializes the PCADataReductionGPU wrapper.
- Parameters
pca_numbers (
ndarray) – Array of integers specifying the number of PCA components to use for reconstruction.approx_svd (
int) – Number of iterations for low-rank SVD approximation (-1 for exact SVD). Defaults to -1.work_dir (
Optional[Union[str,Path]]) – Directory to store results. Defaults to None.special_name (
Optional[str]) – Special name to append to the output keys. Defaults to None.device (
Union[int,str]) – Device to use for computation (e.g., ‘cuda’ or ‘cpu’).verbose (
bool) – If True, print progress updates. Defaults to False.
- class fours.detection_limits.applefy_wrapper.FourSDataReduction(device, lambda_reg, psf_fwhm=None, right_reason_mask_factor=1.5, rotation_grid_down_sample=1, logging_interval=1, save_models=True, train_num_epochs=500, special_name=None, work_dir=None, verbose=False)#
Bases:
DataReductionInterfaceWrapper for the 4S algorithm. This is a simple wrapper around the 4S algorithm, which is implemented in the fours package. The wrapper is used to make the 4S algorithm compatible with the applefy framework.
- __init__(device, lambda_reg, psf_fwhm=None, right_reason_mask_factor=1.5, rotation_grid_down_sample=1, logging_interval=1, save_models=True, train_num_epochs=500, special_name=None, work_dir=None, verbose=False)#
Initializes the FourSDataReduction wrapper. For details on the parameters, see the documentation of the FourS class in the fours package.
- Parameters
device – Device to use for computation (e.g., ‘cpu’ or ‘cuda’).
lambda_reg (
float) – Regularization parameter for the noise model.psf_fwhm – Full width at half maximum of the PSF, used for masking.
right_reason_mask_factor (
float) – Factor for creating the masking region around the planet location. Defaults to 1.5.rotation_grid_down_sample – Down-sampling factor for the rotation grid. Defaults to 1 (no down-sampling).
logging_interval (
int) – Interval for logging progress during training. Defaults to 1.save_models (
bool) – If True, saves 4S noise and normalization models upon completion of training. Defaults to True.train_num_epochs (
int) – Number of epochs for noise model training. Defaults to 500.special_name (
Optional[str]) – Optional special name for output keys. Defaults to None.work_dir (
Optional[str]) – Directory to store output and model files. Defaults to None.verbose (
bool) – If True, prints detailed progress during computation. Defaults to False.