7. Pipeline¶
- pcassie.pipeline.pipeline(sim_wave, sim_flux, v_shift_range=array([-100000., -99000., -98000., -97000., -96000., -95000., -94000., -93000., -92000., -91000., -90000., -89000., -88000., -87000., -86000., -85000., -84000., -83000., -82000., -81000., -80000., -79000., -78000., -77000., -76000., -75000., -74000., -73000., -72000., -71000., -70000., -69000., -68000., -67000., -66000., -65000., -64000., -63000., -62000., -61000., -60000., -59000., -58000., -57000., -56000., -55000., -54000., -53000., -52000., -51000., -50000., -49000., -48000., -47000., -46000., -45000., -44000., -43000., -42000., -41000., -40000., -39000., -38000., -37000., -36000., -35000., -34000., -33000., -32000., -31000., -30000., -29000., -28000., -27000., -26000., -25000., -24000., -23000., -22000., -21000., -20000., -19000., -18000., -17000., -16000., -15000., -14000., -13000., -12000., -11000., -10000., -9000., -8000., -7000., -6000., -5000., -4000., -3000., -2000., -1000., 0., 1000., 2000., 3000., 4000., 5000., 6000., 7000., 8000., 9000., 10000., 11000., 12000., 13000., 14000., 15000., 16000., 17000., 18000., 19000., 20000., 21000., 22000., 23000., 24000., 25000., 26000., 27000., 28000., 29000., 30000., 31000., 32000., 33000., 34000., 35000., 36000., 37000., 38000., 39000., 40000., 41000., 42000., 43000., 44000., 45000., 46000., 47000., 48000., 49000., 50000., 51000., 52000., 53000., 54000., 55000., 56000., 57000., 58000., 59000., 60000., 61000., 62000., 63000., 64000., 65000., 66000., 67000., 68000., 69000., 70000., 71000., 72000., 73000., 74000., 75000., 76000., 77000., 78000., 79000., 80000., 81000., 82000., 83000., 84000., 85000., 86000., 87000., 88000., 89000., 90000., 91000., 92000., 93000., 94000., 95000., 96000., 97000., 98000., 99000., 100000.]), verbose=True, eighcalc='numba', **kwargs)[source]¶
Runs principal component analysis and cross-correlation with simulated signal. Additionally outputs a signal to noise map and Welch’s T-test values. It is more legibple to run
results = pipeline(...)and handle the outputs as indices ofresults.- Parameters:
sim_wave (array) – 1d wavelength grid for the simulated specrum. Must be the same shape as kwargs[‘wave’].
sim_flux (array) – 1d flux values for the simulated spectrum. Must be the same shape as kwargs[‘wave’].
v_shift_range (array) – 1d range of velocity values to sample in the cross-correlation function. Ideally, this is in units of meters/second and orgamized with a 1 km/s step, e.g. the default
np.linspace(-100_000, 100_000, 201). At this stage, a 1 km/s step is assumed to be equivalent to 1 pixel in the CCF grid.verbose (boolean) – Boolean statement to toggle print statements throughout the pipeline.
**kwargs –
For ease of use,
pipelinetakes keyword arguments for the many inputs it requires. This is typically neater organized as:obs_args = {'wave', 'flux', 'mjd_obs', 'ra', 'dec' 'location'},planet_args = {'a', 'P_orb', 'i', 'T_not', 'v_sys'},params = {'transit_start_end', 'gap_size', 'remove_segments', 'first_components', 'last_components'}and called as:pipeline(sim_wave, sim_flux, **obs_args, **planet_args, **params). Please refer to the tutorial for an example use.- wave: array
2d wavelength array of dimensions n sepectra x wavegrid. wavegrid must be consistent across all spectrum, i.e. this is effectively a 1d array repeated for the number of spectra. This will be changed to only input a 1d array in later versions.
- flux: array
2d flux array of dimensions n spectra x wavegrid. n spectra should be sorted with respect to time, i.e.
flux[0]is the spectra observed atmjd_obs[0].- mjd_obs: list or array
List or 1d array of the MJD-OBS value in the specta’s
.fitsfiles. In my implementation, I use the mean of MJD-START and MJD-END, but so long asmjd_obsis properly ordered (e.g. first observation to last observation) the use of MJD-START, MJD-END, or the mean is largely irrelevant. However, it is necessary to have units of MJD (modified julian date).- ra: list or array
List or 1d array of the RA value in the spectra’s
.fitsfiles. Should be ordered in accordance withmjd_obs, e.g.mjd_obs[0]corresponds tora[0]and so on.- dec: list or array
List or 1d array of the DEC value in the spectra’s
.fitsfiles. Should be ordered in accordance withmjd_obs, e.g.mjd_obs[0]corresponds todec[0]and so on.- location: EarthLocation
astropyEarthLocation of the observation facility. Refer to the tutorial andastropydocumentation for more information. The key is that this value fullfills thelocationargument inastropy.time.Time.- a: float
Semi-major axis of the exoplanet in units of AU. This can be found with NASA’s Exoplanet Archive.
- P_orb: float
Orbital period of the exoplanet in units of days. This can be found with NASA’s Exoplanet Archive.
- i: float
The inclination of the exoplanet in units of degrees. This can be found with NASA’s Exoplanet Archive.
- T_not: float
A mid-transit time of the exoplanet in units of modified julian days (MJD). It is not neccesary that this date correponds to the specific transit in your data (I think). TBH I will have to double check with some tests, and this value will likely be unnecessary in later iterations due to the
transit_start_endinput.- v_sys: float
The radial velocity of the exoplanetary system in units of km/s. This can be found with NASA’s Exoplanet Archive.
- transit_start_end: tuple
The start and end times of the transit in your data in units of modified julian date (MJD). Takes the form (start, end).
- gap_size: int
Minimum number of NaNs between detector segments in your flux array to qualify as a separate detector. For CRIRES+, a good value is
gap_size=5. However, test yourself to ensure all detectors are identified. You can do this by comparing the number of detected detectors to those shown in, e.g. the ESO exposure time calculator https://www.eso.org/observing/etc/.- remove_segments: array of ints
Indices of the detectors that you do not want to include in the analysis. This is typically because some detectors are saturated with telluric noise. E.g., in the CRIRES+ analysis, I did not want detectors 1, 2, 3, 4, 6, and 20; therefore
remove_segments=[0, 1, 2, 3, 5, 19].- first_components: int
Number of components to remove starting from the first component found in PCA. The first components correspond to correlated signal, primarily the stellar and telluric spectrum. It helps for this value to immediately disregard the first few components for this reason. 3-5 have been good values in the past. If this value is too low, the pipeline could get trapped in a local maximum in the signal to noise (S/N), which would lead to a suboptimal decomposition.
- last_components: int
Number of components to remove starting from the last component found in PCA. The last components correspond to uncorrelated signal, e.g. instrumental noise. It is less necessary to immediately disregard components here, particulary because the planetary signal sits right at the edge of the noise. In the past, values from 0-3 have worked OK for me.
- Returns:
list – Time-domain PCA reduction. Preferred over the wavelength domain. Takes the form of a list with the number of unremoved detectors as its length. Each index of the list contains a 2d array of shape n spectra x wavelength grid. The wavelength grids are often not consistent between detectors.
list – Wavelength-domain PCA reduction. Takes the form of a list with the number of unremoved detectors as its length. Each index of the list contains a 2d array of shape n spectra x wavelength grid. The wavelength grids are often not consistent between detectors.
list – List of 1d wavelength grids for each unremoved detector.
array – 2d CCF array (n spectra x velocity grid defined in
v_shift_range) in the rest frame of the Earth.array – 2d CCF array (n spectra x
planet_frame_vgrid) doppler corrected into the rest frame of the exoplanet.array – 1d array of the velocity range for the exoplanetary CCF grid. Same format as
v_shift_range, however covers a smaller range.array – 2d CCF array (n in-transit spectra x
planet_frame_vgrid) of only in-transit spectra in the exoplanetary rest frame.array – 2d CCF array sampling values in a radial velocity amplitude array (
Kp_rangexplanet_frame_vgrid). Refer to ccf_tests.sn_map.array – 2d signal to noise (S/N) map array (
Kp_rangexplanet_frame_vgrid). Refer to ccf_tests.sn_map.array – In-trail values of the S/N map. Refer to ccf_tests.welch_t_test.
array – Out-trail values of the S/N map. Refer to ccf_tests.welch_t_test.
array – T-statistic of the S/N map. Refer to ccf_tests.welch_t_test.
array – p value of the S/N map. Refer to ccf_tests.welch_t_test.
- pcassie.pipeline.sample_full_pca_components(sim_wave, sim_flux, v_shift_range=array([-100000., -99000., -98000., -97000., -96000., -95000., -94000., -93000., -92000., -91000., -90000., -89000., -88000., -87000., -86000., -85000., -84000., -83000., -82000., -81000., -80000., -79000., -78000., -77000., -76000., -75000., -74000., -73000., -72000., -71000., -70000., -69000., -68000., -67000., -66000., -65000., -64000., -63000., -62000., -61000., -60000., -59000., -58000., -57000., -56000., -55000., -54000., -53000., -52000., -51000., -50000., -49000., -48000., -47000., -46000., -45000., -44000., -43000., -42000., -41000., -40000., -39000., -38000., -37000., -36000., -35000., -34000., -33000., -32000., -31000., -30000., -29000., -28000., -27000., -26000., -25000., -24000., -23000., -22000., -21000., -20000., -19000., -18000., -17000., -16000., -15000., -14000., -13000., -12000., -11000., -10000., -9000., -8000., -7000., -6000., -5000., -4000., -3000., -2000., -1000., 0., 1000., 2000., 3000., 4000., 5000., 6000., 7000., 8000., 9000., 10000., 11000., 12000., 13000., 14000., 15000., 16000., 17000., 18000., 19000., 20000., 21000., 22000., 23000., 24000., 25000., 26000., 27000., 28000., 29000., 30000., 31000., 32000., 33000., 34000., 35000., 36000., 37000., 38000., 39000., 40000., 41000., 42000., 43000., 44000., 45000., 46000., 47000., 48000., 49000., 50000., 51000., 52000., 53000., 54000., 55000., 56000., 57000., 58000., 59000., 60000., 61000., 62000., 63000., 64000., 65000., 66000., 67000., 68000., 69000., 70000., 71000., 72000., 73000., 74000., 75000., 76000., 77000., 78000., 79000., 80000., 81000., 82000., 83000., 84000., 85000., 86000., 87000., 88000., 89000., 90000., 91000., 92000., 93000., 94000., 95000., 96000., 97000., 98000., 99000., 100000.]), sn_test=-50, sn_max=-100, verbose=True, **kwargs)[source]¶
Loops pipeline() through the component space of the principal component analysis, progressively removing the first components
(associated with the stellar spectrum and tellurics) until S/N in the range of the exoplanetary parameters (+- 15 km/s from Kp=Kp, velocity in planet frame = 0)
is maximized, then doing the same to the end components (associated with uncorrelated/instrumental noise).
- Parameters:
sim_wave (array) – Refer to pipeline.pipeline.
sim_flux (array) – Refer to pipeline.pipeline.
sn_test (int) – Starting value for the S/N test value. Must be greater than
sn_maxbut still start quite low.sn_max (int) – Starting value for the S/N max value. Must be less than
sn_test.verbose (boolean) – Refer to pipeline.pipeline
**kwargs – Refer to pipeline.pipeline.
- Returns:
list – List of the returned values in pipeline.pipeline for the optimal range of PCA components.
int – Optimal value for
first_components.int – Optimal value for
last_components.float – Maximum S/N value in planetary parameter range.
- pcassie.pipeline.sample_components(start_components, stable_components, sim_wave, sim_flux, v_shift_range=array([-100000., -99000., -98000., -97000., -96000., -95000., -94000., -93000., -92000., -91000., -90000., -89000., -88000., -87000., -86000., -85000., -84000., -83000., -82000., -81000., -80000., -79000., -78000., -77000., -76000., -75000., -74000., -73000., -72000., -71000., -70000., -69000., -68000., -67000., -66000., -65000., -64000., -63000., -62000., -61000., -60000., -59000., -58000., -57000., -56000., -55000., -54000., -53000., -52000., -51000., -50000., -49000., -48000., -47000., -46000., -45000., -44000., -43000., -42000., -41000., -40000., -39000., -38000., -37000., -36000., -35000., -34000., -33000., -32000., -31000., -30000., -29000., -28000., -27000., -26000., -25000., -24000., -23000., -22000., -21000., -20000., -19000., -18000., -17000., -16000., -15000., -14000., -13000., -12000., -11000., -10000., -9000., -8000., -7000., -6000., -5000., -4000., -3000., -2000., -1000., 0., 1000., 2000., 3000., 4000., 5000., 6000., 7000., 8000., 9000., 10000., 11000., 12000., 13000., 14000., 15000., 16000., 17000., 18000., 19000., 20000., 21000., 22000., 23000., 24000., 25000., 26000., 27000., 28000., 29000., 30000., 31000., 32000., 33000., 34000., 35000., 36000., 37000., 38000., 39000., 40000., 41000., 42000., 43000., 44000., 45000., 46000., 47000., 48000., 49000., 50000., 51000., 52000., 53000., 54000., 55000., 56000., 57000., 58000., 59000., 60000., 61000., 62000., 63000., 64000., 65000., 66000., 67000., 68000., 69000., 70000., 71000., 72000., 73000., 74000., 75000., 76000., 77000., 78000., 79000., 80000., 81000., 82000., 83000., 84000., 85000., 86000., 87000., 88000., 89000., 90000., 91000., 92000., 93000., 94000., 95000., 96000., 97000., 98000., 99000., 100000.]), sn_test=-50, sn_max=-100, sample_end=False, results=None, verbose=True, **kwargs)[source]¶
Samples through a range of the PCA component space to maximize S/N.
- Parameters:
start_components (int) – Components to immediately remove from start or end.
stable_components (int) – Components of either the start or end that remain consistent. E.g. if the optimal first components have already been found,
stable_componentsis used to maintain thefirst_componentsvalue.sim_wave (array) – Refer to pipeline.pipeline.
sim_flux (array) – Refer to pipeline.pipline.
sn_test (int) – Refer to pipeline.sample_full_pca_components.
sn_max (int) – Refer to pipeline.sample_full_pca_components.
sample_end (boolean) – True if optimizing for the best
last_components, False if sampling for the estfirst_components.results (list) – Returned list of values from pipeline.pipeline.
verbose (boolean) – Refer to untility_functions.debug_print.
**kwargs – Refer to pipeline.pipeline.
- Returns:
List of optimized results from pipeline.pipeline.
- Return type:
list