Utils

This module contain other support functions used by PISCOLA. These functions are documented bellow:

piscola.utils.calculate_robust_stats(values, sigma=5)

Calculates a robust mean and standard deviation not sensitive to outliers.

Parameters:
  • values (array) – Array of values.

  • sigma (float, default 5) – Number of sigmas used for sigma clipping.

Returns:

  • robust_mean (float) – Robust mean.

  • robust_std (float) – Robust standard deviation.

  • robust_mask (bool array) – Mask with valid values as True.

piscola.utils.change_zp(flux, zp, new_zp)

Converts flux units given a new zero-point.

Note: this assumes that the new zero-point is in the same magnitude system as the current one.

Parameters:
  • flux (float or array) – Fluxes.

  • zp (float or array) – Current zero-point for the given fluxes.

  • new_zp (float or array) – New zero-point to convert the flux units.

Returns:

new_flux – Fluxes with with a new zero-point.

Return type:

float or array

piscola.utils.flux_to_mag(flux, flux_err=array([0.]), zp=0.0)

Converts fluxes to magnitudes, propagating errors if given.

Note: if there are negative or zero fluxes, these are converted to NaN values.

Parameters:
  • flux (array) – Array of fluxes.

  • flux_err (array, default np.array([0.0])) – Array of flux errors.

  • zp (float or array, default 0.0) – Zero points.

Returns:

  • mag (array) – Fluxes converted to magnitudes.

  • mag_err (array) – Flux errors converted to errors in magnitudes.

piscola.utils.mag_to_flux(mag, mag_err=array([0.]), zp=0.0)

Converts magnitudes to fluxes, propagating errors if given.

Parameters:
  • mag (array) – Array of magnitudes.

  • mag_err (array, default np.array([0.0])) – Array of magnitude errors.

  • zp (float or array, default 0.0) – Zero points.

Returns:

  • flux (array) – Magnitudes converted to fluxes.

  • flux_err (array) – Magnitude errors converted to errors in fluxes.