cphot 0.1
A C++ tool for computing photometry from spectra.
filter.hpp
Go to the documentation of this file.
1 /**
2  * @defgroup FILTER Filter
3  * @brief Handle Filter definitions and manipulation.
4  *
5  * Define a filter by its name, wavelength and transmission The type of
6  * detector (energy or photon counter) can be specified for adapting
7  * calculations. (default: photon)
8  *
9  * Note the usual astronomical (non SI) units of flux definitions:
10  *
11  * * flam = \f$erg/s/cm^2/AA\f$
12  * * fnu = \f$erg/s/cm^2/Hz\f$
13  * * photflam = \f$photon/s/cm^2/AA\f$
14  * * photnu = \f$photon/s/cm^2/Hz\f$
15  */
16 #pragma once
17 #include "rquantities.hpp"
18 #include <cmath>
19 #include <exception>
20 #include <iostream>
21 #include <regex>
22 #include <stdexcept>
23 #include <string>
24 #include <xtensor/xadapt.hpp>
25 #include <xtensor/xarray.hpp>
26 #include "vega.hpp"
27 
28 /** \ingroup FILTER
29  */
30 namespace cphot {
31 
32 using DMatrix = xt::xarray<double, xt::layout_type::row_major>;
33 
34 /**
35  * @ingroup FILTER
36  * @brief Unit Aware Filter.
37  * input spectra and output values have units to avoid mis-interpretation.
38  *
39  * Define a filter by its name, wavelength and transmission The type of
40  * detector (energy or photon counter) can be specified for adapting
41  * calculations. (default: photon)
42  */
43 class Filter {
44  private:
45  static constexpr double c = speed_of_light.to(angstrom / second);
46  static constexpr double h = 6.62607015e-27; // erg/s
47 
48  //! wavelength of the filter stored in nm
49  DMatrix wavelength_nm;
50  //! transmission of the passband
51  DMatrix transmission;
52  //! name of the filter
53  std::string name = "";
54  //! type, either photon or energy
55  std::string dtype = "photon";
56  //! units of the wavelength (nm by construction)
57  QLength wavelength_unit = nm;
58  //! Central wavelength in nm
59  double cl;
60  //! pivot wavelength in nm
61  double lpivot;
62  //! minimum wavelength in nm
63  double lmin;
64  //! maximum wavelength in nm
65  double lmax;
66  //! norm of the passband
67  double norm;
68  //! effective width in nm
69  double width;
70  //! full width at half maximum in nm
71  double fwhm;
72  //! Photon distribution based effective wavelength.
73  double lphot = 0;
74  //! Effective wavelength
75  double leff = 0;
76  //! Internal int λ * transmission * dλ
77  double lT;
78 
79  void calculate_sed_independent_properties();
80 
81  public:
82  Filter(const DMatrix& wavelength,
83  const DMatrix& transmission,
84  const QLength& wavelength_unit,
85  const std::string dtype,
86  const std::string name);
87  void info();
88 
89  std::string get_name(){ return this->name;}
90  double get_norm();
91  QLength get_leff();
92  QLength get_lphot();
93  QLength get_fwhm();
94  QLength get_width();
95  QLength get_lmax();
96  QLength get_lmin();
97  QLength get_lpivot();
98  QLength get_cl();
99 
100  double get_AB_zero_mag();
101  QSpectralFluxDensity get_AB_zero_flux();
102  QSpectralFluxDensity get_AB_zero_Jy();
103 
104  double get_ST_zero_mag();
105  QSpectralFluxDensity get_ST_zero_flux();
106  QSpectralFluxDensity get_ST_zero_Jy();
107 
108  double get_Vega_zero_mag();
109  QSpectralFluxDensity get_Vega_zero_flux();
110  QSpectralFluxDensity get_Vega_zero_Jy();
111 
113  DMatrix get_wavelength(const QLength& in);
115 
116  bool is_photon_type();
117 
118  QSpectralFluxDensity get_flux(const DMatrix& wavelength,
119  const DMatrix& flux,
120  const QLength& wavelength_unit,
121  const QSpectralFluxDensity& flux_unit);
122 
123  Filter reinterp(const DMatrix& new_wavelength_nm);
124  Filter reinterp(const DMatrix& new_wavelength,
125  const QLength& new_wavelength_unit);
126 };
127 
128 /**
129  * @brief Construct a new Filter:: Filter object
130  *
131  * @param wavelength wavelength definition
132  * @param transmission transmission on the wavelength
133  * @param wavelength_unit units of the wavelength definition
134  * @param dtype "photon" or "energy"
135  * @param name name of the passband
136  * @throw std::runtime_error if detector type is invalid
137  */
139  const DMatrix& transmission,
140  const QLength& wavelength_unit,
141  const std::string dtype,
142  const std::string name){
143  double convfac = wavelength_unit.to(nanometre);
144  this->wavelength_nm = convfac * wavelength;
145  this->wavelength_unit = nm;
146  this->name = name;
147  this->transmission = transmission;
148 
149  if ((dtype.compare("photon") == 0) ||
150  (dtype.compare("energy") == 0)){
151  this->dtype = dtype;
152  } else {
153  throw std::runtime_error("only photon and energy allowed");
154  }
155  this->calculate_sed_independent_properties();
156 }
157 
158 /**
159  * @brief Nice representation of Filter objects
160  *
161  * @param os stream to output the representation
162  * @param F Filter object
163  * @return std::ostream& same as os
164  */
165 std::ostream & operator<<(std::ostream &os,
166  Filter &F){
167  os << "Filter: " << F.get_name()
168  << "\n";
169  return os;
170 }
171 
172 /**
173  * @brief Calculate the various standard properties of a given filter.
174  *
175  * These properties are e.g., fwhm, pivot wavelength.
176  * Those that do not require to consider an SED such as Vega.
177  */
178 void Filter::calculate_sed_independent_properties(){
179  // Calculate Filter properties
180  const auto& wavelength_nm = this->wavelength_nm;
181  const auto& transmission = this->transmission;
182 
183  size_t n_points = transmission.size();
184  double transmission_max = xt::amax(transmission)[0];
185  double transmission_max_100th = transmission_max / 100.;
186 
187  auto norm = xt::trapz(transmission, wavelength_nm)[0];
188  auto _lT = xt::trapz(wavelength_nm * transmission, wavelength_nm)[0];
189  auto _cl = norm > 0 ? _lT / norm : 0.;
190  this->cl = _cl;
191  this->norm = norm;
192  this->lT = _lT;
193  double lpivot2 = 0.;
194  if (this->dtype.compare("photon") == 0){
195  lpivot2 = _lT / trapz(transmission / wavelength_nm, wavelength_nm)[0];
196  } else {
197  lpivot2 = norm / trapz(transmission / xt::square(wavelength_nm), wavelength_nm)[0];
198  }
199  this->lpivot = std::sqrt(lpivot2);
200 
201  // the last value with a transmission at least 1% of maximum transmission
202  double lmax = wavelength_nm[0];
203  // the first value with a transmission at least 1% of maximum transmission
204  double lmin = wavelength_nm[n_points - 1];
205  for (size_t i=0; i < transmission.size(); ++i){
206  if (transmission[i] > transmission_max_100th){
207  lmax = std::max(lmax, wavelength_nm[i]);
208  lmin = std::min(lmin, wavelength_nm[i]);
209  }
210  }
211  this->lmin = lmin;
212  this->lmax = lmax;
213 
214  // Effective width
215  // Equivalent to the horizontal size of a rectangle with height equal
216  // to maximum transmission and with the same area that the one covered by
217  // the filter transmission curve.
218  // W = int(T dlamb) / max(T)
219  this->width = (norm / xt::amax(transmission)[0]);
220 
221  // FWHM
222  // the difference between the two wavelengths for which filter transmission is
223  // half maximum
224  //
225  // ..note::
226  // This calculation is not exact but rounded to the nearest passband data
227  // points
228  double first = wavelength_nm[0];
229  double last = wavelength_nm[-1];
230  double thresh = transmission_max * 0.5;
231  for (size_t i=0; i < wavelength_nm.size() - 1; ++i){
232  if((transmission[i+1] > thresh) and (transmission[i] <= thresh)){
233  first = wavelength_nm[i];
234  break;
235  }
236  }
237  for (size_t i=wavelength_nm.size(); i > 1; --i){
238  if((transmission[i-1] > thresh) and (transmission[i] <= thresh)){
239  last = wavelength_nm[i];
240  break;
241  }
242  }
243  this->fwhm = last - first;
244 
245  // leff = int (lamb * T * Vega dlamb) / int(T * Vega dlamb)
246  auto vega = Vega();
247  const DMatrix& vega_wavelength = vega.get_wavelength(nm);
248  const DMatrix& vega_flux = vega.get_flux(flam);
249  auto vega_T = xt::interp(vega_wavelength, this->get_wavelength(nm), this->get_transmission(), 0., 0.);
250  this->leff = xt::trapz(vega_wavelength * vega_T * vega_flux, vega_wavelength)[0] /
251  xt::trapz(vega_T * vega_flux, vega_wavelength)[0];
252 
253  // lphot = int(lamb ** 2 * T * Vega dlamb) / int(lamb * T * Vega dlamb)
254  this->lphot = xt::trapz(xt::square(vega_wavelength) * vega_T * vega_flux, vega_wavelength)[0] /
255  xt::trapz(vega_wavelength * vega_T * vega_flux, vega_wavelength)[0];
256 }
257 
258 /**
259  * @brief AB magnitude zero point
260  *
261  * \f[ mag_{AB} = -2.5 * log10(f_nu) - 48.60
262  * = -2.5 \log_{10}(f_\lambda) - 2.5 * \log_{10}(\lambda_{pivot}^2 / c) - 48.60 \f]
263  *
264  * @return AB magnitude zero point
265  */
267  double C1 = (this->wavelength_unit).to(angstrom);
268  C1 = C1 * C1 / speed_of_light.to(angstrom / second);
269  C1 = this->lpivot * this->lpivot * C1;
270  return 2.5 * std::log10(C1) + 48.60;
271 }
272 
273 /**
274  * @brief AB flux zero point
275  *
276  * Calculated as
277  * \f[ flux_{AB} = 10^{-0.4 * (mag_{AB})} \f]
278  *
279  * @return AB flux zero point
280  */
281 QSpectralFluxDensity Filter::get_AB_zero_flux(){
282  return std::pow(10, -0.4 * this->get_AB_zero_mag()) * flam;
283 }
284 
285 /**
286  * @brief AB flux zero point in Jansky (Jy)
287  *
288  * Calculated as
289  * \f[ flux_{Jy} = \frac{10^5}{10^{-8} c } \lambda_{pivot}^2 flux_{AB} \f]
290  * where \f$c\f$ is speed of light in m/s, and \f$\lambda_{pivot}\f$ is the pivot wavelength in angstrom,
291  * and \f$flux_{AB}\f$ is the AB flux in flam.
292  *
293  * @return AB flux zero point in Jansky (Jy)
294  */
295 QSpectralFluxDensity Filter::get_AB_zero_Jy(){
296  double c = 1e-8 * speed_of_light.to(meter / second);
297  double f = 1e5 / c * std::pow(this->get_lpivot().to(angstrom), 2) * this->get_AB_zero_flux().to(flam);
298  return f * Jy;
299 }
300 
301 /**
302  * @brief ST magnitude zero point
303  *
304  * Set by definition to 21.1 mag
305  *
306  * @return ST magnitude zero point
307  */
309  return 21.1; // definition
310 }
311 
312 /**
313  * @brief ST flux zero point
314  *
315  * Calculated as
316  * \f[ flux_{ST} = 10^{-0.4 * (mag_{ST})} \f]
317  *
318  * @return ST flux in flam
319  */
320 QSpectralFluxDensity Filter::get_ST_zero_flux(){
321  return std::pow(10, -0.4 * this->get_ST_zero_mag()) * flam;
322 }
323 
324 /**
325  * @brief ST flux zero point in Jansky (Jy)
326  *
327  * Calculated as
328  * \f[ flux_{Jy} = \frac{10^5}{10^{-8} c } \lambda_{pivot}^2 flux_{ST} \f]
329  * where \f$c\f$ is speed of light in m/s, and \f$\lambda_{pivot}\f$ is the pivot wavelength in angstrom,
330  * and \f$flux_{ST}\f$ is the ST flux in flam.
331  *
332  * @return ST flux in Jy
333  */
334 QSpectralFluxDensity Filter::get_ST_zero_Jy(){
335  double c = 1e-8 * speed_of_light.to(meter / second);
336  double f = 1e5 / c * std::pow(this->get_lpivot().to(angstrom), 2) * this->get_ST_zero_flux().to(flam);
337  return f * Jy;
338 }
339 
340 /**
341  * @brief Vega magnitude zero point
342  *
343  * @return Vega magnitude zero point
344  */
346  return -2.5 * std::log10(this->get_Vega_zero_flux().to(flam));
347 }
348 
349 /**
350  * @brief Vega flux zero point
351  *
352  * @return flux of Vega in flam (erg/s/cm^2/Angstrom)
353  */
354 QSpectralFluxDensity Filter::get_Vega_zero_flux(){
355  Vega v = Vega();
356  double flux_flam = this->get_flux(
357  v.get_wavelength(nm),
358  v.get_flux(flam),
359  nm, flam).to(flam);
360  return flux_flam * flam;
361 }
362 
363 /**
364  * @brief Vega flux zero point in Jansky (Jy)
365  *
366  * Calculated as
367  * \f[ flux_{Jy} = \frac{10^5}{10^{-8} c } \lambda_{pivot}^2 flux_{Vega} \f]
368  * where \f$c\f$ is speed of light in m/s, and \f$\lambda_{pivot}\f$ is the pivot wavelength in angstrom,
369  * and \f$flux_{Vega}\f$ is the Vega flux in flam.
370  *
371  * @return flux of Vega in Jy
372  */
373 QSpectralFluxDensity Filter::get_Vega_zero_Jy(){
374  double c = 1e-8 * speed_of_light.to(meter / second);
375  double f = 1e5 / c * std::pow(this->get_lpivot().to(angstrom), 2) * this->get_Vega_zero_flux().to(flam);
376  return f * Jy;
377 }
378 
379 /**
380  * @brief Integrate the flux within the filter and return the integrated energy/flux
381  *
382  * The filter is first interpolated on the spectrum wavelength definition.
383  * The flux is then calculated as the integral of the flux within the filter depending on the detector type as:
384  *
385  * - for photon detectors:
386  * \f[
387  * f_\lambda = \frac{\int \lambda T(\lambda) f_\lambda d\lambda}{\int \lambda T(\lambda) d\lambda}
388  * \f]
389  *
390  * - for energy detectors:
391  * \f[
392  * f_\lambda = \frac{\int T(\lambda) f_\lambda d\lambda}{\int T(\lambda) d\lambda}
393  * \f]
394  *
395  * @param wavelength wavelength array
396  * @param flux flux array
397  * @param wavelength_unit wavelength unit
398  * @param flux_unit flux unit
399  * @return integrated flux through the filter
400  *
401  */
402 QSpectralFluxDensity Filter::get_flux(
403  const DMatrix& wavelength,
404  const DMatrix& flux,
405  const QLength& wavelength_unit,
406  const QSpectralFluxDensity& flux_unit) {
407  //filter on wavelength units
408  const DMatrix& filt_wave = this->get_wavelength(wavelength_unit);
409  const DMatrix& filt_trans = this->get_transmission();
410 
411  // Check overlaps
412  if ((xt::amin(filt_wave)[0] > xt::amax(wavelength)[0])
413  || (xt::amax(filt_wave)[0] < xt::amin(wavelength)[0])) {
414  return 0. * flux_unit;
415  }
416 
417  // reinterpolate the transmission to the spectrum wavelength
418  auto new_trans = xt::interp(wavelength, filt_wave, filt_trans, 0., 0.);
419 
420  // check transmission is not null everywhere
421  if (! xt::any(new_trans > 0)){
422  return 0. * flux_unit;
423  }
424  // Calculate the flux depending on detector type
425  if (this->is_photon_type()){
426  double a = xt::trapz(wavelength * new_trans * flux, wavelength)[0];
427  double b = xt::trapz(wavelength * new_trans, wavelength)[0];
428  return a / b * flux_unit;
429  } else {
430  double a = xt::trapz(new_trans * flux, wavelength)[0];
431  double b = xt::trapz(new_trans, wavelength)[0];
432  return a / b * flux_unit;
433  }
434 }
435 
436 /**
437  * @brief New filter interpolated to match a wavelegnth definition
438  *
439  * @param new_wavelength_nm wavelength definition in nm
440  * @return new filter interpolated to match the new wavelength definition
441  */
442 Filter Filter::reinterp(const DMatrix& new_wavelength_nm){
443  const DMatrix& filt_wave = this->get_wavelength();
444  const DMatrix& filt_trans = this->get_transmission();
445  auto new_trans = xt::interp(new_wavelength_nm, filt_wave, filt_trans, 0., 0.);
446  return Filter(new_wavelength_nm, new_trans, nm, this->dtype, this->name);
447 }
448 
449 /**
450  * @brief New filter interpolated to match a wavelegnth definition
451  *
452  * @param new_wavelength wavelength definition
453  * @param new_wavelength_unit wavelength unit
454  * @return new filter interpolated to match the new wavelength definition
455  */
456 Filter Filter::reinterp(const DMatrix& new_wavelength, const QLength& new_wavelength_unit){
457  const DMatrix& filt_wave = this->get_wavelength(new_wavelength_unit);
458  const DMatrix& filt_trans = this->get_transmission();
459  auto new_trans = xt::interp(new_wavelength, filt_wave, filt_trans, 0., 0.);
460  return Filter(new_wavelength, new_trans, new_wavelength_unit,
461  this->dtype, this->name);
462 }
463 
464 /**
465  * @brief Display some information on cout
466  */
468  size_t n_points = this->transmission.size();
469  std::cout << "Filter Object information:\n"
470  << " name: " << this->name << "\n"
471  << " detector type: " << this->dtype << "\n"
472  << " wavelength units: " << "nm (internally set)" << "\n"
473  << " central wavelength: " << this->cl << " nm" << "\n"
474  << " pivot wavelength: " << this->lpivot << " nm" << "\n"
475  << " effective wavelength: " << this->leff << " nm" << "\n"
476  << " photon wavelength: " << this->lphot << " nm" << "\n"
477  << " minimum wavelength: " << this->lmin << " nm" << "\n"
478  << " maximum wavelength: " << this->lmax << " nm" << "\n"
479  << " norm: " << this->norm << "\n"
480  << " effective width: " << this->width << " nm" << "\n"
481  << " fullwidth half-max: " << this->fwhm << " nm" << "\n"
482  << " definition contains " << n_points << " points" << "\n"
483  << " \n"
484  << " Zeropoints \n"
485  << " Vega: " << this->get_Vega_zero_mag() << " mag" << "\n"
486  << " " << this->get_Vega_zero_flux().to(flam) << " erg/s/cm^2/AA" << "\n"
487  << " " << this->get_Vega_zero_Jy().to(Jy) << " Jy" << "\n"
488  << " AB: " << this->get_AB_zero_mag() << " mag" << "\n"
489  << " " << this->get_AB_zero_flux().to(flam) << " erg/s/cm^2/AA" << "\n"
490  << " " << this->get_AB_zero_Jy().to(Jy) << " Jy" << "\n"
491  << " ST: " << this->get_ST_zero_mag() << " mag" << "\n"
492  << " " << this->get_ST_zero_flux().to(flam) << " erg/s/cm^2/AA" << "\n"
493  << " " << this->get_ST_zero_Jy().to(Jy) << " Jy" << "\n"
494  << "\n";
495 }
496 
497 /**
498  * @brief Central wavelength
499  *
500  * \f[ \lambda_{cl} = \frac{\int \lambda T(\lambda) d\lambda}{\int T(\lambda) d\lambda}\f]
501  *
502  * @return central wavelength in nm
503  */
504 QLength Filter::get_cl(){ return this->cl * this->wavelength_unit;}
505 
506 /**
507  * @brief Pivot wavelength in nm
508  *
509  * if photon detector:
510  * \f[ \lambda_p^2 = \frac{\int \lambda T(\lambda) d\lambda}{\int T(\lambda) d\lambda / \lambda} \f]
511  *
512  * if energy:
513  * \f[ \lambda_p^2 = \frac{\int T(\lambda) d\lambda}{\int T(\lambda) d\lambda / \lambda^2} \f]
514  *
515  * @return pivot wavelength in nm
516  */
517 QLength Filter::get_lpivot(){ return this->lpivot * this->wavelength_unit;}
518 
519 /**
520  * @brief the first λ value with a transmission at least 1% of maximum transmission
521  *
522  * @return min wavelength in nm
523  */
524 QLength Filter::get_lmin(){ return this->lmin * this->wavelength_unit;}
525 
526 /**
527  * @brief the last λ value with a transmission at least 1% of maximum transmission
528  *
529  * @return max wavelength in nm
530  */
531 QLength Filter::get_lmax(){ return this->lmax * this->wavelength_unit;}
532 
533 /**
534  * @brief the norm of the passband
535  *
536  * \f[ norm = \int T(\lambda) d\lambda \f]
537  *
538  * @return norm
539  */
540 double Filter::get_norm(){ return this->norm; }
541 
542 /**
543  * @brief Effective width
544  *
545  * \f[ width = \frac{\int T(\lambda) d\lambda}{\max(T(\lambda))} \f]
546  *
547  * @return width in nm
548  */
549 QLength Filter::get_width(){ return this->width * this->wavelength_unit;}
550 
551 /**
552  * @brief the difference between the two wavelengths for which filter
553  * transmission is half maximum.
554  *
555  * ..note::
556  * This calculation is not exact but rounded to the nearest passband
557  * data points
558  *
559  * @return fwhm in nm
560  */
561 QLength Filter::get_fwhm(){ return this->fwhm * this->wavelength_unit;}
562 
563 /**
564  * @brief Photon distribution based effective wavelength.
565  *
566  * Defined as
567  * \f[ \lambda_{phot} = \frac{\int\lambda^2 T(\lambda) Vega(\lambda) d\lambda }{\int\lambda T(\lambda) Vega(\lambda) d\lambda} \f]
568  *
569  * @return QLength
570  */
571 QLength Filter::get_lphot(){ return this->lphot * this->wavelength_unit;}
572 
573 /**
574  * @brief Effective wavelength
575  *
576  * \f[ \lambda_{eff} = \frac{\int \lambda T(\lambda) Vega(\lambda) d\lambda)}{\int T(\lambda) Vega(\lambda) d\lambda)} \f]
577  *
578  * @return Effective wavelenth
579  */
580 QLength Filter::get_leff(){ return this->leff * this->wavelength_unit;}
581 
582 /**
583  * @brief Get the wavelength in nm
584  *
585  * @return wavelegnth in nm
586  */
588  return this->wavelength_nm;
589 }
590 
591 /**
592  * @brief Get the wavelength in requested units
593  *
594  * @param in units to convert to
595  * @return wavelegnth in requested units
596  */
597 DMatrix Filter::get_wavelength(const QLength& in) {
598  return this->wavelength_nm * nm.to(in);
599 }
600 
601 /**
602  * @brief Get the transmission
603  *
604  * @return Transmission (unitless)
605  */
607  return this->transmission;
608 }
609 
610 /**
611  * @brief Check the type of the detector
612  *
613  * @return true photon
614  * @return false energy
615  */
617  return (this->dtype.compare("photon") == 0);
618 }
619 
620 }; // namespace cphot
cphot::Filter::get_AB_zero_Jy
QSpectralFluxDensity get_AB_zero_Jy()
AB flux zero point in Jansky (Jy)
Definition: filter.hpp:295
cphot::Filter::get_Vega_zero_Jy
QSpectralFluxDensity get_Vega_zero_Jy()
Vega flux zero point in Jansky (Jy)
Definition: filter.hpp:373
cphot::Filter::get_cl
QLength get_cl()
Central wavelength.
Definition: filter.hpp:504
cphot_sun_theoretical::wavelength
const std::vector< double > wavelength
Definition: sun_data.hpp:15
cphot_sun_theoretical::flux
const std::vector< double > flux
Definition: sun_data.hpp:17
cphot::Filter::reinterp
Filter reinterp(const DMatrix &new_wavelength_nm)
New filter interpolated to match a wavelegnth definition.
Definition: filter.hpp:442
cphot::operator<<
std::ostream & operator<<(std::ostream &os, Filter &F)
Nice representation of Filter objects.
Definition: filter.hpp:165
cphot::Filter::get_norm
double get_norm()
the norm of the passband
Definition: filter.hpp:540
rquantities.hpp
cphot_sun_theoretical::flux_unit
const QSpectralFluxDensity flux_unit
Definition: sun_data.hpp:20
cphot::Filter::get_flux
QSpectralFluxDensity get_flux(const DMatrix &wavelength, const DMatrix &flux, const QLength &wavelength_unit, const QSpectralFluxDensity &flux_unit)
Integrate the flux within the filter and return the integrated energy/flux.
Definition: filter.hpp:402
cphot::DMatrix
xt::xarray< double, xt::layout_type::row_major > DMatrix
Definition: filter.hpp:32
cphot::Vega::get_flux
DMatrix get_flux()
Get the internal flux in flam.
Definition: vega.hpp:146
nanometre
constexpr QLength nanometre
Definition: rquantities.hpp:271
cphot::Filter::is_photon_type
bool is_photon_type()
Check the type of the detector.
Definition: filter.hpp:616
cphot::Filter::get_Vega_zero_mag
double get_Vega_zero_mag()
Vega magnitude zero point.
Definition: filter.hpp:345
cphot::Filter::get_lphot
QLength get_lphot()
Photon distribution based effective wavelength.
Definition: filter.hpp:571
cphot::Filter
Unit Aware Filter. input spectra and output values have units to avoid mis-interpretation.
Definition: filter.hpp:43
cphot::Filter::get_lpivot
QLength get_lpivot()
Pivot wavelength in nm.
Definition: filter.hpp:517
cphot::Vega::get_wavelength
DMatrix get_wavelength()
Get the internal wavelength in nm.
Definition: vega.hpp:127
cphot::Filter::get_name
std::string get_name()
Definition: filter.hpp:89
cphot::Filter::get_ST_zero_mag
double get_ST_zero_mag()
ST magnitude zero point.
Definition: filter.hpp:308
cphot::Filter::info
void info()
Display some information on cout.
Definition: filter.hpp:467
angstrom
constexpr QLength angstrom
Definition: rquantities.hpp:274
a
const GenericPointer< typename T::ValueType > T2 T::AllocatorType & a
Definition: pointer.h:1121
cphot::Vega
Interface to Vega reference data.
Definition: vega.hpp:32
cphot::Filter::get_ST_zero_Jy
QSpectralFluxDensity get_ST_zero_Jy()
ST flux zero point in Jansky (Jy)
Definition: filter.hpp:334
c
constexpr QSpeed c
Definition: rquantities.hpp:351
speed_of_light
constexpr QSpeed speed_of_light
Definition: rquantities.hpp:350
cphot::Filter::get_wavelength
DMatrix get_wavelength()
Get the wavelength in nm.
Definition: filter.hpp:587
cphot::Filter::get_fwhm
QLength get_fwhm()
the difference between the two wavelengths for which filter transmission is half maximum.
Definition: filter.hpp:561
cphot::Filter::get_width
QLength get_width()
Effective width.
Definition: filter.hpp:549
vega.hpp
cphot::Filter::get_leff
QLength get_leff()
Effective wavelength.
Definition: filter.hpp:580
cphot::Filter::get_transmission
DMatrix get_transmission()
Get the transmission.
Definition: filter.hpp:606
cphot_vega::flux_flam
const std::vector< double > flux_flam
Definition: vega_data.hpp:16
cphot
Definition: filter.hpp:30
cphot::Filter::get_Vega_zero_flux
QSpectralFluxDensity get_Vega_zero_flux()
Vega flux zero point.
Definition: filter.hpp:354
Jy
constexpr QSpectralFluxDensity Jy
Definition: rquantities.hpp:364
meter
constexpr QLength meter
Definition: rquantities.hpp:266
cphot::Filter::get_AB_zero_flux
QSpectralFluxDensity get_AB_zero_flux()
AB flux zero point.
Definition: filter.hpp:281
cphot::Filter::Filter
Filter(const DMatrix &wavelength, const DMatrix &transmission, const QLength &wavelength_unit, const std::string dtype, const std::string name)
Construct a new Filter:: Filter object.
Definition: filter.hpp:138
nm
constexpr QLength nm
Definition: rquantities.hpp:273
cphot_sun_theoretical::wavelength_unit
const QLength wavelength_unit
Definition: sun_data.hpp:19
cphot::Filter::get_AB_zero_mag
double get_AB_zero_mag()
AB magnitude zero point.
Definition: filter.hpp:266
flam
constexpr QSpectralFluxDensity flam
Definition: rquantities.hpp:361
cphot::Filter::get_lmax
QLength get_lmax()
the last λ value with a transmission at least 1% of maximum transmission
Definition: filter.hpp:531
cphot::Filter::get_lmin
QLength get_lmin()
the first λ value with a transmission at least 1% of maximum transmission
Definition: filter.hpp:524
second
constexpr QTime second(1.0)
cphot::Filter::get_ST_zero_flux
QSpectralFluxDensity get_ST_zero_flux()
ST flux zero point.
Definition: filter.hpp:320