Adapt the data
Adapt Observations and Models:
- ForMoSA.adapt.adapt_obs_mod.launch_adapt(global_params, adapt_model=True)[source]
Adapt the synthetic spectra of a grid to make them comparable with the data.
- Parameters:
global_params (object) – Class containing each parameter
adapt_model (bool) – True by default to also adapt the grid
- Returns:
None
Author: Simon Petrus, Matthieu Ravet, Paulina Palma-Bifani and Allan Denis
Adapt Grid:
- ForMoSA.adapt.adapt_grid.adapt_grid(global_params, obs_dict, res_mod_nativ, target_wav_mod, target_res_mod, obs_name, indobs=0)[source]
Adapt the synthetic spectra of a grid to make them comparable with the data.
- Parameters:
global_params (object) – Class containing each parameter
obs_dict (dict) – Dictionay containing all the observationnal entries (photometry, spectroscopy and/or optional)
res_mod_nativ (array) – Native resolution of the grid (might have changed if Nyquist is not respected or resample at wav_obs_spectro)
target_wav_mod (array) – Targeted wavelength grid of the final grid
target_res_mod (array) – Targeted spectral resolution of the final grid
obs_name (str) – Name of the current observation looping
indobs (int) – Index of the current observation looping
- Returns:
None
Author: Simon Petrus, Matthieu Ravet, Paulina Palma-Bifani, Arthur Vigan and Allan Denis
- ForMoSA.adapt.adapt_grid.array_to_numpy(shared_array, shape, dtype)[source]
Return a numpy array from a shared array
- Parameters:
shared_array (mp.RawArray) – Raw shared array
shape (tuple) – Shape of the array
dtype (numpy dtype) – Data type of the array
- Returns
numpy_array (np.ndarray): Numpy array mapped to shared array
Author: Arthur Vigan
- ForMoSA.adapt.adapt_grid.tpool_adapt(idx, global_params, obs_dict, wav_mod_nativ, res_mod_nativ, target_wav_mod, target_res_mod, indobs, keys, titles, values)[source]
Worker function for the parallelisation process of adapt_model()
- Parameters:
idx (tuple) – Index of the current model
global_params (object) – Class containing each parameter
wav_mod_nativ (array) – Native wavelength array of the grid
res_mod_nativ (array) – Native resolution of the grid (might have changed if Nyquist is not respected or resample at wav_obs_spectro)
target_wav_mod (array) – Targeted wavelength grid of the final grid
target_res_mod (array) – Targeted spectral resolution of the final grid
indobs (int) – Index of the current observation looping
keys (list) – Attribute keys
titles (list) – Attribute titles
values (dict) – Values for each attribute
- Returns:
None
Author: Arthur Vigan
- ForMoSA.adapt.adapt_grid.tpool_adapt_init(grid_input_shape_i, grid_input_data_i, grid_spectro_shape_i, grid_spectro_data_i, grid_photo_shape_i, grid_photo_data_i)[source]
Thread pool init function for the parallelisation process of adapt_model()
This function initializes the global variables stored as shared arrays
Extraction Functions:
- ForMoSA.adapt.adapt_extraction_functions.adapt_model(global_params, obs_dict, wav_mod_nativ, flx_mod_nativ, res_mod_nativ, target_wav_mod, target_res_mod, indobs=0)[source]
Extracts a synthetic spectrum from a grid and decreases its spectral resolution. The photometry points are calculated too.
- Parameters:
global_params (object) – Class containing each parameter used in ForMoSA
obs_dict (dict) – Dictionay containing all the observationnal entries (photometry, spectroscopy and/or optional)
wav_mod_nativ (array) – Native wavelength grid of the model
flx_mod_nativ (array) – Flux of the model
res_mod_nativ (array) – Spectral resolution of the model
target_wav_mod (array) – Targeted wavelength grid of the final grid
target_res_mod (array) – Targeted spectral resolution of the final grid
indobs (int) – Index of the current observation looping
- Returns:
List containing the sub-spectra defined by the parameter “wav_for_adapt”. - mod_photo (array): List containing the photometry (‘0’ replace the spectral resolution here).
- Return type:
mod_spectro (array)
Author: Simon Petrus, Matthieu Ravet
- ForMoSA.adapt.adapt_extraction_functions.adapt_observation(global_params, wav_mod_nativ, res_mod_nativ, obs_name, indobs=0)[source]
Take back the extracted data spectrum from the function ‘extract_observation’, decrease its spectral resolution and remove the continuum if necessary
- Parameters:
global_params (object) – Class containing each parameter
wav_mod_nativ (array) – Wavelength grid of the model
res_mod_nativ (array) – Spectral resolution of the model
obs_name (str) – Name of the current observation looping
indobs (int) – Index of the current observation looping
- Returns:
Dictionay containing all the observationnal entries (photometry, spectroscopy and/or optional)
- Return type:
obs_dict (dict)
Author: Simon Petrus, Matthieu Ravet
- ForMoSA.adapt.adapt_extraction_functions.extract_observation(global_params, indobs=0)[source]
Extract the information from the observation file, including the wavelengths (um - vacuum), flux (W.m-2.um.1), errors (W.m-2.um.1), covariance (W.m-2.um.1)**2, spectral resolution, instrument/filter name, transmission (Atmo+inst) and star flux (W.m-2.um.1). The wavelength range is define by the parameter “wav_for_adapt”.
- Parameters:
global_params (object) – Class containing each parameter
obs_name (str) – Name of the current observation looping
indobs (int) – Index of the current observation looping
- Returns:
Dictionay containing all the observationnal entries (photometry, spectroscopy and/or optional)
- Return type:
obs_dict (dict)
Author: Simon Petrus, Matthieu Ravet and Allan Denis