<jupyter_start><jupyter_text>pyphot - Interface with SVO filter profile service[http://svo2.cab.inta-csic.es/theory/fps/](http://svo2.cab.inta-csic.es/theory/fps/)If your research benefits from the use of the SVO Filter Profile Service, include the following acknowledgement in your publication:> This research has made use of the SVO Filter Profile Service> (http://svo2.cab.inta-csic.es/theory/fps/) supported from the Spanish MINECO> through grant AYA2017-84089.and please include the following references in your publication:* The SVO Filter Profile Service. <NAME>., <NAME>., <NAME>., 2012; https://ui.adsabs.harvard.edu/abs/2012ivoa.rept.1015R/abstract* The SVO Filter Profile Service. <NAME>., <NAME>., 2020; https://ui.adsabs.harvard.edu/abs/2020sea..confE.182R/abstractSome examples are provided in this notebookFull documentation available at http://mfouesneau.github.io/docs/pyphot/<jupyter_code>%matplotlib inline

import pylab as plt
import numpy as np

import sys
sys.path.append('../')
from pyphot import sandbox as pyphot
from pyphot.svo import get_pyphot_filter as get_filter_from_svo<jupyter_output><empty_output><jupyter_text>Quick Start Quick start example to access the library and it's content<jupyter_code>lst = ["2MASS/2MASS.J", "2MASS/2MASS.H", "2MASS/2MASS.Ks",
       "HST/ACS_WFC.F475W", "HST/ACS_WFC.F814W"]
filters = [get_filter_from_svo(k) for k in lst]
filters
# get the internal default library of passbands filters
filters[0].info(show_zeropoints=True)<jupyter_output>Filter object information:
    name:                 2MASS_2MASS.J
    detector type:        energy
    wavelength units:     nm
    central wavelength:   1241.051880 nanometer
    pivot wavelength:     1235.808838 nanometer
    effective wavelength: 1228.565473 nanometer
    photon wavelength:    1232.122857 nanometer
    minimum wavelength:   1082.000000 nanometer
    maximum wavelength:   1406.000000 nanometer
    norm:                 162.432434
    effective width:      162.432434 nanometer
    fullwidth half-max:   3.000000
    definition contains 107 points

    Zeropoints
        Vega: 23.756942 mag,
              3.1421235331555586e-10 erg / angstrom * centimeter ** 2 * second,
              1600.682312315791 Jy
              189.9446782639982 photon / angstrom * centimeter ** 2 * second
          AB: 22.867705 mag,
              7.127186272302632e-10 erg / angstrom * centimeter ** 2 * second,
              3630.7805477009997 Jy
          ST: 21.100000 mag,
              3.630[...]<jupyter_text>Suppose one has a calibrated spectrum and wants to compute the vega magnitude throug the HST WFC3 F110W passband,<jupyter_code># convert to magnitudes
import numpy as np

# We'll use Vega spectrum as example
from pyphot import Vega
vega = Vega()
f = filters[-1]
# compute the integrated flux through the filter f
# note that it work on many spectra at once
fluxes = f.get_flux(vega.wavelength, vega.flux, axis=-1)
# Note that fluxes is now with units of erg/s/cm2/AA
# pyphot gives Vega in flam and can convert between flux density units. 
fluxes, vega.wavelength, vega.flux
# convert to vega magnitudes
mags = -2.5 * np.log10(fluxes.value) - f.Vega_zero_mag
print("Vega magnitude of Vega in {0:s} is : {1:f} mag".format(f.name, mags))
mags = -2.5 * np.log10(fluxes.value) - f.AB_zero_mag
print("AB magnitude of Vega in {0:s} is : {1:f} mag".format(f.name, mags))
mags = -2.5 * np.log10(fluxes.value) - f.ST_zero_mag
print("ST magnitude of Vega in {0:s} is : {1:f} mag".format(f.name, mags))<jupyter_output>Vega magnitude of Vega in HST_ACS_WFC.F814W is : 0.000000 mag
AB magnitude of Vega in HST_ACS_WFC.F814W is : 0.421694 mag
ST magnitude of Vega in HST_ACS_WFC.F814W is : 1.257270 mag
{'fraction_non_alphanumeric': 0.09679158802911836, 'fraction_numerical': 0.08358047991372337, 'mean_word_length': 3.585908529048208, 'pattern_counts': {'":': 0, '<': 16, '<?xml version=': 0, '>': 19, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '3', 'dir': 'jupyter-structured-clean-dedup', 'id': '274574', 'license': 'MIT', 'n_tokens_mistral': 1485, 'n_tokens_neox': 1250, 'n_words': 375, 'path': 'examples/svo.ipynb', 'repo_name': 'mfouesneau/pyphot', 'size': '3724'}