Wrappers#
Applefy allows to compute contrast curves with different post-processing algorithms. However, it does not come with any implementation of these techniques. Instead, we use existing implementations in packages like PynPoint or VIP.
PynPoint Wrappers#
The following wrapper classes allow to use PynPoint with applefy. PynPoint is not on the requirement list of applefy. It has to be installed separately.
- class applefy.wrappers.pynpoint.SimplePCAPynPoint(num_pca)#
Bases:
DataReductionInterface
The SimplePCAPynPoint is a wrapper around the simple full frame PCA implemented in PynPoint. It only allows to compute the residuals for a fixed number of PCA components. The advantage of this wrapper over
MultiComponentPCAPynPoint()
is, that it does not require to create a PynPoint database file.- __init__(num_pca)#
Constructor of the class.
- Parameters
num_pca (
int
) – The number of PCA components to be used.
- get_method_keys()#
Get the method name “PCA (#num_pca components)”.
- __call__(stack_with_fake_planet, parang_rad, psf_template, exp_id)#
Compute the full-frame PCA.
- Parameters
stack_with_fake_planet (
ndarray
) – A 3d numpy array of the observation sequence. Fake plants are inserted by applefy in advance.parang_rad (
ndarray
) – A 1d numpy array containing the parallactic angles in radians.psf_template (
ndarray
) – A 2d numpy array with the psf-template (usually the unsaturated star).exp_id (
str
) – Experiment ID of the config used to add the fake planet. It is a unique string and can be used to store intermediate results. Seegenerate_fake_planet_experiments()
for more information about the config files.
- Return type
- Returns
A dictionary which contains the residual of the PCA reduction with the dict-key “PCA (#num_pca components)”.
- class applefy.wrappers.pynpoint.MultiComponentPCAPynPoint(num_pcas, scratch_dir, num_cpus_pynpoint=1)#
Bases:
DataReductionInterface
The MultiComponentPCAPynPoint is a wrapper around the full frame PCA implemented in PynPoint. While the wrapper
SimplePCAPynPoint()
only accepts a single fixed number of PCA components, MultiComponentPCAPynPoint computes several residuals with different number of components. This can be more efficient as the PCA basis needs to be computed only once. The disadvantage overSimplePCAPynPoint()
is that MultiComponentPCAPynPoint needs to create a Pynpoint database and delete it after computing the residuals.- __init__(num_pcas, scratch_dir, num_cpus_pynpoint=1)#
Constructor of the class.
- get_method_keys()#
Get the method name “PCA (#num_pca components)”.
- __call__(stack_with_fake_planet, parang_rad, psf_template, exp_id)#
Compute the full-frame PCA for several numbers of PCA components.
- Parameters
stack_with_fake_planet (
ndarray
) – A 3d numpy array of the observation sequence. Fake plants are inserted by applefy in advance.parang_rad (
ndarray
) – A 1d numpy array containing the parallactic angles in radians.psf_template (
ndarray
) – A 2d numpy array with the psf-template (usually the unsaturated star).exp_id (
str
) – Experiment ID of the config used to add the fake planet. It is a unique string and can be used to store intermediate results. Seegenerate_fake_planet_experiments()
for more information about the config files.
- Return type
- Returns
A dictionary which contains the residuals of the PCA reduction with the dict-keys “PCA (#num_pca components)”.
VIP Wrappers#
The following wrapper classes allow to use VIP with applefy. VIP is not on the requirement list of applefy. It has to be installed separately.
- class applefy.wrappers.vip.SimplePCAvip(num_pca, kwarg=None)#
Bases:
DataReductionInterface
The SimplePCAvip is a wrapper around the simple full frame PCA implemented in VIP. It only allows to compute the residuals for a fixed number of PCA components.
- __init__(num_pca, kwarg=None)#
Constructor of the class.
- get_method_keys()#
Get the method name “PCA (#num_pca components)”.
- __call__(stack_with_fake_planet, parang_rad, psf_template, exp_id)#
Compute the full-frame PCA.
- Parameters
stack_with_fake_planet (
ndarray
) – A 3d numpy array of the observation sequence. Fake plants are inserted by applefy in advance.parang_rad (
ndarray
) – A 1d numpy array containing the parallactic angles in radians.psf_template (
ndarray
) – A 2d numpy array with the psf-template (usually the unsaturated star).exp_id (
str
) – Experiment ID of the config used to add the fake planet. It is a unique string and can be used to store intermediate results. Seegenerate_fake_planet_experiments()
for more information about the config files.
- Return type
- Returns
A dictionary which contains the residual of the PCA reduction with the dict-key “PCA (#num_pca components)”.
- class applefy.wrappers.vip.MultiComponentPCAvip(num_pcas, kwarg=None)#
Bases:
DataReductionInterface
The MultiComponentPCAvip is a wrapper around the full frame PCA implemented in VIP. While the wrapper
SimplePCAvip()
only accepts a single fixed number of PCA components, MultiComponentPCAvip computes several residuals with different number of components.- __init__(num_pcas, kwarg=None)#
Constructor of the class.
- get_method_keys()#
Get the method name “PCA (#num_pca components)”.
- __call__(stack_with_fake_planet, parang_rad, psf_template, exp_id)#
Compute the full-frame PCA for several numbers of PCA components.
- Parameters
stack_with_fake_planet (
ndarray
) – A 3d numpy array of the observation sequence. Fake plants are inserted by applefy in advance.parang_rad (
ndarray
) – A 1d numpy array containing the parallactic angles in radians.psf_template (
ndarray
) – A 2d numpy array with the psf-template (usually the unsaturated star).exp_id (
str
) – Experiment ID of the config used to add the fake planet. It is a unique string and can be used to store intermediate results. Seegenerate_fake_planet_experiments()
for more information about the config files.
- Return type
- Returns
A dictionary which contains the residuals of the PCA reduction with the dict-keys “PCA (#num_pca components)”.
- class applefy.wrappers.vip.PCAannvip(num_pca, kwarg=None)#
Bases:
DataReductionInterface
The PCAannvip is a wrapper around the annular PCA implemented in VIP. It only allows to compute the residuals for a fixed number of PCA components.
- __init__(num_pca, kwarg=None)#
Constructor of the class.
- get_method_keys()#
Get the method name “PCAann (#num_pca components)”.
- __call__(stack_with_fake_planet, parang_rad, psf_template, exp_id)#
Compute the annular PCA.
- Parameters
stack_with_fake_planet (
ndarray
) – A 3d numpy array of the observation sequence. Fake plants are inserted by applefy in advance.parang_rad (
ndarray
) – A 1d numpy array containing the parallactic angles in radians.psf_template (
ndarray
) – A 2d numpy array with the psf-template (usually the unsaturated star).exp_id (
str
) – Experiment ID of the config used to add the fake planet. It is a unique string and can be used to store intermediate results. Seegenerate_fake_planet_experiments()
for more information about the config files.
- Return type
- Returns
A dictionary which contains the residual of the PCA reduction with the dict-key “PCAann (#num_pca components)”.
- class applefy.wrappers.vip.MultiComponentPCAannvip(num_pcas, kwarg=None)#
Bases:
DataReductionInterface
The MultiComponentPCAannvip is a wrapper around the annular PCA implemented in VIP. While the wrapper
PCAannvip()
only accepts a single fixed number of PCA components, MultiComponentPCAannvip computes several residuals with different number of components.- __init__(num_pcas, kwarg=None)#
Constructor of the class.
- get_method_keys()#
Get the method name “PCAann (#num_pca components)”.
- __call__(stack_with_fake_planet, parang_rad, psf_template, exp_id)#
Compute the full-frame PCA for several numbers of PCA components.
- Parameters
stack_with_fake_planet (
ndarray
) – A 3d numpy array of the observation sequence. Fake plants are inserted by applefy in advance.parang_rad (
ndarray
) – A 1d numpy array containing the parallactic angles in radians.psf_template (
ndarray
) – A 2d numpy array with the psf-template (usually the unsaturated star).exp_id (
str
) – Experiment ID of the config used to add the fake planet. It is a unique string and can be used to store intermediate results. Seegenerate_fake_planet_experiments()
for more information about the config files.
- Return type
- Returns
A dictionary which contains the residuals of the PCA reduction with the dict-keys “PCA (#num_pca components)”.