Welcome to Pyterpol’s documentation!

Contents:

pyterpol.synthetic.auxiliary.flatten_2d(arr)[source]

Flattens 2-dim array

Parameters:arr – 2d array
Returns:
pyterpol.synthetic.auxiliary.generate_least_number(l)[source]

Goes over integer in list and finds the smallest integer not in the list.

Parameters:l – the list
Returns:int the smallest integer
pyterpol.synthetic.auxiliary.instrumental_broadening(wave, flux, width=0.25, width_type='sigma', interpolate_back=True)[source]

A convolution of a spectrum with a normal distribution.

Param:

wave:

Param:

flux:

Parameters:
  • width
  • width_type
Returns:

pyterpol.synthetic.auxiliary.interpolate_block(x, block, xnew)[source]

Interpolates in each line of a 2d array.

Parameters:
  • x (numpy.float64) – independent variable
  • block (numpy.float64) – 2d array for each column f(x)= block[i]
  • xnew (float) – point at which it is interpolated
Returns:

pyterpol.synthetic.auxiliary.interpolate_block_faster(x, block, xnew)[source]

Interpolation of teh spectra... hopefully faster?

Parameters:
  • x
  • block
  • xnew
Returns:

pyterpol.synthetic.auxiliary.interpolate_spec(wave0, intens0, wave1)[source]

Defines a function intens0 = f(wave0) and than interpolates in it at wave1.

Parameters:
  • wave0 (numpy.float64) – initial wavelength array
  • intens0 (numpy.float64) – initial intensity array
  • wave1 (numpy.float64) – wavelength array at which we interpolate
Return intens1:

final intensity array

Rtype intens1:

numpy.float64

pyterpol.synthetic.auxiliary.is_within_interval(v, arr)[source]

Tests whether value v lies within interval [min(arr); max(arr)]

Parameters:
  • v (numpy.float64) – tested values
  • arr – tested array
Returns:

Param:
Type:

bool

pyterpol.synthetic.auxiliary.keys_to_lowercase(d)[source]

Converts dictionary keys to lowercase

:param d the converted dictionary :return: dnew

pyterpol.synthetic.auxiliary.parlist_to_list(l, property='value')[source]

Converts a list of Parameter class to a regular list - only the property is returned

Parameters:
  • l
  • prop
Returns:

pyterpol.synthetic.auxiliary.read_text_file(f)[source]

Reads ascii file f.

Parameters:f (str) – the file
Return lines:list of all lines within file f
Return type:list
pyterpol.synthetic.auxiliary.renew_file(f)[source]

Deletes an existing file.

Parameters:f
Returns:
pyterpol.synthetic.auxiliary.rotate_spectrum(wave, intens, vrot, epsilon=0.6, interpolate_back=True)[source]

Rotates a spectrum represented by arrays wave and intes to the prjected rotational velocity vrot.

Parameters:
  • wave (numpy.float64) – wavelength array
  • intens (numpy.float64) – intensity array
  • vrot (float) – projected rotational velocity in km/s
  • epsilon (float) – Coefficient of linear limb-darkening.
  • interpolate_back (bool) – interpolate the spectrum back to the original wavelength sampling
Return intens:

the rotated spectrum in the original wavelength sanmpling

Rtype intens:

numpy.float64

Return intens_conv:
 

the rotated spectrum equidistant in rv

Rtype intens_conv:
 

numpy.float64

Return wave_conv:
 

the wavelength array equidistant in rv

Rtype wave_conv:
 

numpy.float64

pyterpol.synthetic.auxiliary.select_index_for_multiple_keywords(d, **kwargs)[source]

From a dictionary of lists selects one index meeting all requirements.

Parameters:kwargs
Returns:
pyterpol.synthetic.auxiliary.shift_spectrum(wave, RV)[source]

Doppler-shifts spectrum. :param wave: original wavelength array :type wave: numpy.float64 :param RV: radial velocity in km/s :type RV: float :return new_wave: shifted wavelength array :rtype new_wave: numpy.float64

pyterpol.synthetic.auxiliary.string2bool(s)[source]

Converts string to boolean.

Parameters:s
Returns:
pyterpol.synthetic.auxiliary.sum_dict_keys(d)[source]

Sums dictionary key records.

Parameters:d – the dictionary
Returns:s the sum
pyterpol.synthetic.auxiliary.write_numpy(f, cols, fmt)[source]

An example of lack of brain of the main developer of this “code”.

Parameters:
  • f – outputfile or handler
  • cols – block of data to be writte
  • fmt – format of the blocs
Returns:

None

Indices and tables