Skip to content

API_Documentation

Nathan Saucourt edited this page Jul 29, 2025 · 10 revisions

API Documentation

Below is a summary of functional modules available in the v1_dev_mac branch.

TABLE OF CONTENT API

/OPTRA/

TABLE OF CONTENT OPTRA

Module Description
op_pipeline.py Main driver for the pipeline execution
op_rawdata.py Extract and Calibrate the raw datas
op_corrflux.py Compute the Correlated Flux
op_vis.py Compute the squared visibility
op_flux.py Extract the flux
op_clos.py Compute the closure phase
op_oifits.py Create the oifits file
op_parameters.py Store the global parameters
op_instruments.py Store the instruments parameters
n_co2/ Update the Co2 model
uv_coverage/ UV-coverage toolkit to go further
phase_correction/ Computation and Comparison of models of air refractive index

API Documentation OPTRA

You will find under the Complete API Documentation for OPTRA

op_pipeline.py

op_sort_files:

Sort the files by their category and type

PARAMETERS:

  • data_dir : directory of the data

RETURN:

  • data_collection: dictionnary of the data sorted

op_assign_sky:

Assign the closest skyfile to each exposure

PARAMETERS:

  • data_collection : dictionnary of the sorted data

RETURN:

  • data_collection: dictionnary of the data sorted with the matched sky added.

op_assign_bias:

Assign the bias to each exposusre

PARAMETERS:

  • data_collection : dictionnary of the sorted data

RETURN:

  • None

op_assign_flat:

Assign the flat field map to each exposusre

PARAMETERS:

  • data_collection : dictionnary of the sorted data

RETURN:

  • None

op_assign_bpm:

Assign the bad pixel map to each exposusre

PARAMETERS:

  • data_collection : dictionnary of the sorted data

RETURN:

  • None

op_compute_oifits:

Compute the correlated flux, the squared visibility from the raw files and store them in the oifits files

PARAMETERS:

  • starfile: file of the star
  • skyfile: file of the assiociated sky
  • badfile: file of the assiociated bad pixel map
  • flatfile: file of the assiociated flat field map
  • shiftfile: file of the associated shift map

Optional Parameters:

  • outdir=None: specify if another directory
  • verbose=False : specify if you want to have all the logs printed
  • plot=False : specify if you want the plots to appear

RETURN:

  • None (but OIFITS File generated)

op_rawdata.py

op_interpolate_bad_pixels:

Interpolate the bad pixels

PARAMETERS:

  • data : datas from the raw files
  • bad_pixel_map : Bad Pixel Map

Optional Parameters:

  • verbose=False : specify if you want to have all the logs printed

RETURN:

  • data: raw data corrected by the bad pixel
  • filtered_data: filter applied to the raw data

op_load_bpm:

Load the bad pixels map

PARAMETERS:

  • filename : file of the bad pixel map

Optional Parameters:

  • verbose=False : specify if you want to have all the logs printed

RETURN:

  • bpm: bad Pixel Map

op_apply_bpm:

Apply the bad pixels map to the raw datas

PARAMETERS:

  • rawdata : datas from the raw files
  • bpmap : Bad Pixel Map

Optional Parameters:

  • verbose=False : specify if you want to have all the logs printed

RETURN:

  • rawdata : data corrected from the bad pixel

op_load_ffm:

Load the flat field map

PARAMETERS:

  • filename : file of the flat field map

Optional Parameters:

  • verbose=False : specify if you want to have all the logs printed

RETURN:

  • ffm : Flat Field Map

op_apply_ffm:

Apply the flat field map to the raw datas

PARAMETERS:

  • rawdata : datas from the raw files
  • ffmap : Flat field Map

Optional Parameters:

  • verbose=False : specify if you want to have all the logs printed

RETURN:

  • rawdata: data corrected from the ffm

op_subtract_sky:

Substract the mean of the sky to the raw datas

PARAMETERS:

  • rawdata : datas from the raw files
  • skydata : data of the sky

Optional Parameters:

  • verbose=False : specify if you want to have all the logs printed
  • plot=False : specify if you want the plots to appear

op_print_fits_structure:

Display the structure of a FITS file

PARAMETERS:

  • fitsdata : datas from the raw files

op_print_fits_header:

Display the header of a FITS file

PARAMETERS:

  • fitsdata : datas from the raw files

op_load_rawdata :

Load the raw datas from the FITS files and store them

PARAMETERS:

  • filename : name of the FITS file

op_loadAndCal_rawdata:

Load and Calibrate the raw datas from the FITS files

PARAMETERS:

  • sciencefile : File of the Target
  • skyfile : File of the associated sky
  • bpm : Bad pixel map file
  • ffm : flat field map file

Optional Parameters:

  • instrument=op_MATISSE_L: instrument used
  • verbose=False : specify if you want to have all the logs printed
  • plot=False : specify if you want the plots to appear

_op_get_location:

Get the location of the telescopes:

PARAMETERS:

  • hdr: Header of a fit file
  • plot: Specify if you want to plot the map of Paranal

Optional Parameters:

  • verbose=False : specify if you want to have all the logs printed

_op_calculate_uvw:

Compute the uvw coordinates

PARAMETERS:

  • data : uvw coord dictionnary to be corrected.
  • bvect: baseline vector of observation.
  • loc: Location of Paranal

_op_positionsTelescope:

Get the station of the telescopes

PARAMETERS:

  • hdr : hdr of a fits file
  • bvect: baseline vector of observation.
  • loc: Location of Paranal

_op_get_baseVect:

get the baseline vector between 2 stations

PARAMETERS:

  • station1 : name of the first station
  • station2 : name of the second station
  • loc: Location of Paranal

Optional Parameters:

  • delay = dict(): dictionnary to store the fix delay

_op_compute_baseVect:

Extract all the baseline vector

PARAMETERS:

  • hdr : hdr of a fits file
  • loc: Location of Paranal

Optional Parameters:

*instrument = op_MATISSE_L: Instrument used (to get the scramble)

op_compute_uv:

Compute the uv Coordinate corresponding to one FITS file.

PARAMETERS:

  • cfdata: data from the FITS file.
  • loc: Location of Paranal

Optional Parameters:

*instrument = op_MATISSE_L: Instrument used (to get the scramble)

op_uv_coverage

Generate the uv-coverage

PARAMETERS:

  • uCoord: all the u coordinate of the night
  • vCoord: all the v coordinate of the night

Optional Parameters:

*instrument = op_MATISSE_L: Instrument used (to get the scramble)


op_corrflux.py

op_apodize:

Apodize the Calibrated data

PARAMETERS:

  • data : Calibrated data

op_calc_fft

Compute the Fast Fourier Transform of our datas

PARAMETERS:

  • data : Calibrated data

op_get_wlen:

Compute the wavelength:

PARAMETERS:

  • shift_map: Shift Map
  • rawdata : Calibrated data

op_get_peaks_position:

Extract the peaks position

PARAMETERS:

  • fftdata : Fourier Transformed data

Optional Parameters:

*instrument = op_MATISSE_L: Instrument used

op_extract_CF:

Compute the correlated Flux

PARAMETERS:

  • fftdata : Fourier Transformed data
  • peaks : peaks of each baselines in the fft
  • peakswd: width of each peaks

op_demodulate:

Demodulate MATISSE Fringes

PARAMETERS:

  • CFdata : Correlated Flux data

Optional Parameters:

*cfin = 'CF': From which data in the dictionnary you demodulate.

op_get_corrflux

Compute the Correlated Flux and apply all the phase correction from the Calibrated datas

PARAMETERS:

  • bdata : Calibrated data
  • shiftfile: Shift Map File

op_reorder_baselines:

Reorder the baselines ( Reorder based on the bcd)

PARAMETERS:

  • data : correlated flux data

Optional Parameters:

  • cfin = 'CF_demod': From which data you reorder.

op_get_amb_conditions:

Get the atmospheric conditions and the dPath

PARAMETERS:

  • data : correlated flux data

op_compute_nco2

Compute the Co2 concentration at Paranal in ppm

PARAMETERS:

  • data : correlated flux data

op_air_index

Compute the air refractive index

PARAMETERS:

  • wlen : Wavelength (in m )
  • T : Temperature (in C)
  • P : Pressure (in hPa)
  • h : Relative humidity
  • N_CO2 : Co2 concentration (in ppm)

op_corr_n_air

Correct the air refractive index in the phase

PARAMETERS:

  • data : correlated flux data
  • n_air : Air refractive index
  • dPath : differential path

Optional Parameters:

  • cfin = 'CF_reord': From which data you correct the air refractive index.

op_get_piston_fft

Compute the residual piston on the Correlated flux phase, via FFT method

PARAMETERS:

  • data : correlated flux data

Optional Parameters:

  • cfin = 'CF_Binned': From which data you get the piston.

op_corr_piston

Correct the residual piston

PARAMETERS:

  • data : correlated flux data

Optional Parameters:

  • cfin = 'CF_Binned': From which data you get the piston.

op_bin_data:

Bin the data.

PARAMETERS:

  • data : correlated flux data

Optional Parameters:

  • binning = 5: Coefficient of binning
  • cfin = 'CF_achr_phase_corr': From which data you will bin.

op_get_error_vis:

Extract the error of the correlated flux

PARAMETERS:

  • data : correlated flux data

Optional Parameters:

  • cfin = 'CF_piston_corr2': From which data you get the error.

op_snr

Compute the snr thanks to the error computed before.

PARAMETERS:

  • wlen : wavelength array
  • vis : Correlated flux datas
  • visAmpErr:Error on the amplitude of the Correlated flux
  • visPhiErr: Error on the Phase of the Correlated Flux

op_snr_theory:

Compute the SNR based on a semi theoretical value of the SNR.

PARAMETERS:

  • data : correlated flux data

Optional Parameters:

  • cfin = 'CF_Binned': From which data you get the piston.

op_mean_corrflux:

Extract the mean of the correlated flux.

PARAMETERS:

  • data : correlated flux data

Optional Parameters:

  • cfin = 'CF_piston_corr2': From which data you compute the mean.

op_vis.py

op_compute_vis_bias

Compute the bias of the visibility

PARAMETERS:

  • data : correlated flux data

op_extract_simplevis2

extract the squared visibility

PARAMETERS:

  • data : correlated flux data

op_average_vis2

extract the mean of the suared visibilty

op_correct_balance_simplevis2

op_compute_vfactor

op_correct_vfactor


op_flux.py


op_clos.py


op_oifits.py

op_gen_oiarray:

Create the OI_ARRAY Table

PARAMETERS:

  • data : correlated flux data

op_gen_oitarget:

Create the OI_TARGET Table

PARAMETERS:

  • data : correlated flux data

op_gen_oiwavelength:

Create the OI_WAVELENGTH Table

PARAMETERS:

  • data : correlated flux data

Optional Parameters:

  • wlen_fin = 'EFF_WAVE_Binned': Specify if the wlen is binned or not

op_gen_oivis:

Create the OI_VIS Table

PARAMETERS:

  • data : correlated flux data

op_gen_oivis2:

Create the OI_VIS2 Table

PARAMETERS:

  • data : squared visibilities data

op_write_oivis:

Create the OIFITS file and store the datas in it

PARAMETERS:

  • filename : Name of the output file
  • hdr : hdr of the FITS File
  • oiwavelength : OI_WAVELENGTH Table

Optional Parameters

  • oirray = None : OI_ARRAY Table
  • oitarget = None : OI_TARGET Table
  • oivis = None : OI_VIS Table
  • oivis2 = None : OI_VIS2 Table
  • oit3 = None :OI_T3 Table

op_parameters.py


op_instruments.py


/SPEXTRA/

Orbit Fitting

prepare_astrometry.py

astrometry_multiprocessing_realimagpoly.py

spectrometry_complex_nochi2.py: spectral fit routine without chi² criterion

📚 Wiki Navigation

🏁 Getting Started

📖 Learn

🧪 Reference

Clone this wiki locally