API

popurri.peakutils Module

Functions

b_overlap_a(a, b[, alab, blab, verb])

Check if there is any value in b inside the range of the values in a.

find_abspeak_list(w, f, wlines[, ...])

Find the minimum peaks in the spectrum w, f closest to the wavelength positions in the list wlines.

find_abspeak_list_echelle(w, f, wlines[, ...])

find_abspeaks(f[, method])

Find minima and maxima of spectrum f.

find_abspeaks_echelle(f[, method, ords_use])

fit_gaussian_peak(w, f[, amp_hint, ...])

Fit a single Gaussian to a spectrum line.

fit_gaussian_spec(w, f, imin, imax1, imax2)

Fit len(imin) peaks in the spectrum w, f.

gaussian(x[, amp, cen, wid, shift])

Gaussian function: G(x) = shift + amp * e**(-(x-cen)**2 / (2*wid**2))

gaussian_contrasterr(amp, shift[, amperr, ...])

gaussian_fwhm([wid])

gaussian_fwhmerr([wid, widerr])

gaussian_minmax([shift, amp])

idxmin_custom(f)

Find all minima in spectrum.

idxminends_custom(f, imin)

Find "ends of the minima" in spectrum f, i.e. maxima at each side of the minimum.

min_find_maxabs(y[, imin])

Find the absolute maxima at each side of the minimum in y.

min_find_maxclosest(y[, imin])

Find the maxima closest the minimum in y, one at each side.

popurri.plotutils Module

General plotting utilities

Colormaps: - https://matplotlib.org/stable/gallery/color/colormap_reference.html - https://colorcet.holoviz.org/user_guide/index.html - https://matplotlib.org/cmocean/

Functions

figout(fig[, sv, filout, svext, sh, cl])

Save or display a figure.

mpl_custom_basic()

Customize basic appearance: - ticks in all axis - tick direction in, size major 6 minor 3, width 1.2 all - axes line width 1.2 - marker size 7 and line width 2 - custom colorcycle: black, orange, blue...

mpl_size_same([font_size])

multiline(xs, ys, c[, ax])

Plot lines with different colorings

plot_map(f, label, ax[, interpolation, ...])

Plot flux map. imshow() assumes data is regularly spaced! extent : floats (left, right, bottom, top) Define the coordinates of the image area.

wavelength_label([x])

Classes

Labeloffset(ax[, label, axis])

https://stackoverflow.com/questions/45760763/how-to-move-the-y-axis-scale-factor-to-the-position-next-to-the-y-axis-label

LineCollection(segments, *[, zorder])

Represents a sequence of .Line2Ds that should be drawn together.

popurri.spectrum Module

spectrum module

Methods to read and plot spectra from different instruments.

Functions

dopplershift(x, v[, rel])

x : float

get_header_snr(filin, inst[, ext])

Keywords are the order number (starting at 0 for the bluest order).

get_params_header(filin, inst[, ...])

Get general common parameters from header.

pix2wave(x, coeff)

Convert pixel to wavelength using the coefficients from the e2ds header, for a single echelle order.

pix2wave_echelle(x, coeff)

read_header(filin[, ext])

Read FITS header.

read_header_kw_table([filtable, verbose])

Read table that contains general parameters keywords used in this code and their corresponding FITS header keyword for different instruments.

read_spec_carmnir(filin[, ordcut, saveordnoncut])

NIR discontinuity at the center of the order: between pixel 2039 and pixel 2040.

read_spec_carmvis(filin)

Read CARACAL ouput.

read_spec_crires(filin)

read_spec_criresplus(filin)

read_spec_espresso(filin)

read_spec_espresso_hr(filin)

read_spec_espresso_mr(filin)

read_spec_espresso_uhr(filin)

read_spec_expres(filin)

read_spec_harps(filin[, kwinst, nord, ...])

Read e2ds reduced spectrum flux and wavelength, and optionally the blaze.

read_spec_harpsn(filin[, kwinst, nord, ...])

Read HARPS-N e2ds reduced spectrum flux and wavelength, and optionally the blaze.

read_spec_maroonx(filin)

read_spec_neid(filin)

read_spectra(lisfil, inst[, returnclass, dirout])

returnclass : bool

read_spectrum(filin, inst, **kwargs)

Read spectrum from file filin.

wair2vac(w)

Transform air wavelength to vacuum wavelength.

wavelength_label([x])

wpolycoeff(filin[, kwinst, nord])

From e2ds header FITS file get the polynomial coefficients necessary to transform from pixels to wavelength.

wvac2air(w)

Transform vacuum wavelength to air wavelength.

Classes

MaxNLocator([nbins])

Place evenly spaced ticks, with a cap on the total number of ticks.

Path(*args, **kwargs)

PurePath subclass that can make system calls.

Spectra(lisfil, inst[, dirout, obj, tag, ...])

Collection of (time series) spectra of the same instrument.

Spectrum(filin, inst[, dirout, obj, tag, ...])

Spectrum class

popurri.spectrograph Module

Spectrograph-related functions

  • TODO CRIRES+ plotting different detectors

  • TODO ESPRESSO, MAROON-X plotting different slices

Functions

get_filords(inst)

get_ghosts_criresplus()

read_ords(inst, filords, **kwargs)

Read orders of specific instrument.

read_ords_carmnir(filords[, ordcut])

read_ords_carmvis(filords)

read_ords_crires(filords)

read_ords_criresplus(filords)

read_ords_espresso(filords)

read_ords_espresso_hr(filords)

read_ords_espresso_mr(filords)

read_ords_expres(filords)

read_ords_harps(filords)

read_ords_harpsn(filords)

read_ords_maroonx(filords)

read_ords_neid(filords)

read_spectrograph_properties([filprop])

Read spectrograph properties from file

wavelength_label([x])

Classes

MaxNLocator([nbins])

Place evenly spaced ticks, with a cap on the total number of ticks.

Spectrograph(inst[, dirout, filprop, ordcut])

Spectrograph class

SpectrographsProperties([dirout, filprop])

General properties of spectrographs.

popurri.telluricutils Module

Functions

broaden_mask(w, f, dv)

Broaden mask by a velocity dv [m/s].

broaden_wlimits(w1, w2, dv)

Same as broaden_mask, but takes as input the wavelength limits of each mask line, instead of the wavelength and flux (0110).

interp_mask_inverse(w, f[, kind])

Interpolation function of the telluric mask inverted (so that lines are zeros, i.e. False) to be used to mask telluric regions in the data.

is_there_overlap_wlimits(w1, w2)

Check if there is overlap between 2 consecutive telluric regions.

join_overlap_wlimits(w1, w2)

Join consecutive telluric regions if there is overlap.

join_overlap_wlimits_once(w1, w2)

Join consecutive telluric regions if there is overlap.

mask2wlimits(w, f)

Get wavelength limits of the telluric lines masked.

read_esoskycalc_telluric(filin[, extra])

Read transmision telluric model spectrum generated with ESO SkyCalc.

read_esoskycalc_telluric_transmission(filin)

OLD FUNCTION!

read_mask(filin[, xunit])

Read telluric mask from file.

wavelength_label([x])

wlimits2mask(w1, w2[, dw])

Convert telluric regions indicated by wavelengths w1 and w2 to a mask with format: flux = 0110 per region.

Classes

Mask([filin, w, f, dirout, diroutplot, tag, ...])

Telluric mask class.

ModelEsoSkyCalc(filin[, dirout, diroutplot, ...])

w : array

interp1d(x, y[, kind, axis, copy, ...])

Interpolate a 1-D function.

popurri.utils Module

General utils

Functions

time_print(func)

Decorator to print the time a function takes to run.