source: Sophya/trunk/SophyaLib/SkyT/nupower.cc@ 610

Last change on this file since 610 was 610, checked in by ansari, 26 years ago

Corrections diverses - programme tgsky.cc (generation aleatoire de ciel)

et skymixer.cc completee - Reza 21/11/99

File size: 1.5 KB
RevLine 
[601]1//--------------------------------------------------------------------------
2// File and Version Information:
[610]3// $Id: nupower.cc,v 1.3 1999-11-21 23:25:45 ansari Exp $
[601]4//
5// Description:
6// Aim of the class: To give the energy density for a nupower
7// The unity used here is W/m^2/Hz/sr
8//
9// History (add to end):
10// Sophie Oct, 1999 - creation
11//
12//------------------------------------------------------------------------
13
14//---------------
15// C++ Headers --
16//---------------
17#include "machdefs.h"
18#include <iostream.h>
19#include <math.h>
20
21#include "nupower.h"
22
23//----------------
24// Constructor --
25//----------------
[610]26PowerLawSpectra::PowerLawSpectra(double a, double b, double nu0, double dnu, double numin, double numax)
[601]27 : RadSpectra(numin, numax)
28{
29 _a = a;
30 _b = b;
31 _nu0 = nu0;
[610]32 _dnu = (dnu > 1.e-19) ? dnu : 1.;
[601]33}
34
35
36PowerLawSpectra::~PowerLawSpectra()
37{
38}
39
40double
41PowerLawSpectra::flux(double nu) const
42{
[610]43 if ((nu< _numin) || (nu > _numax)) return(0.);
44 double tmp = (nu-_nu0)/_dnu;
45 if (tmp <= 0.) return(0.);
46 else return( _a * pow(tmp, _b) );
[601]47}
48
49void
50PowerLawSpectra::Print(ostream& os) const
51{
[610]52 os << "PowerLawSpectra::Print f = a ((nu-nu0)/dnu)^b " << _a << "((nu-" << _nu0
53 << ") / " << _dnu << ") ^ " << _b << endl;
[601]54 os << " - Fmin,Fmax= " << minFreq() << "," << maxFreq() << endl;
55 os << "MeanFreq= " << meanFreq() << " Emission= " << flux(meanFreq()) << endl;
56 os << "PeakFreq= " << peakFreq() << " Emission= " << flux(peakFreq()) << endl;
57
58}
Note: See TracBrowser for help on using the repository browser.