Last change
on this file since 1062 was
1053,
checked in by MatthewWhiting, 12 years ago
|
Fixing a few more incomplete includes
|
File size:
1.2 KB
|
Line | |
---|
1 | #include <iostream> |
---|
2 | #include <math.h> |
---|
3 | #include <duchamp/FitsIO/Beam.hh> |
---|
4 | #include <duchamp/duchamp.hh> |
---|
5 | |
---|
6 | namespace duchamp |
---|
7 | { |
---|
8 | |
---|
9 | Beam::Beam(): |
---|
10 | itsMaj(0), itsMin(0), itsPA(0), itsArea(0) |
---|
11 | { |
---|
12 | } |
---|
13 | |
---|
14 | Beam::Beam(float maj, float min, float pa): |
---|
15 | itsMaj(maj),itsMin(min),itsPA(pa) |
---|
16 | { |
---|
17 | this->calculateArea(); |
---|
18 | } |
---|
19 | |
---|
20 | Beam::Beam(const Beam &b) |
---|
21 | { |
---|
22 | operator=(b); |
---|
23 | } |
---|
24 | |
---|
25 | Beam& Beam::operator=(const Beam &b) |
---|
26 | { |
---|
27 | if(this == &b ) return *this; |
---|
28 | this->itsMaj = b.itsMaj; |
---|
29 | this->itsMin = b.itsMin; |
---|
30 | this->itsPA = b.itsPA; |
---|
31 | this->itsArea = b.itsArea; |
---|
32 | return *this; |
---|
33 | } |
---|
34 | |
---|
35 | void Beam::calculateArea() |
---|
36 | { |
---|
37 | this->itsArea = M_PI * (this->itsMaj/2.) * (this->itsMin/2.) / M_LN2; |
---|
38 | } |
---|
39 | |
---|
40 | void Beam::areaToFWHM() |
---|
41 | { |
---|
42 | float fwhm = 2.*sqrt( this->itsArea * M_LN2 / M_PI ); |
---|
43 | this->itsMaj = fwhm; |
---|
44 | this->itsMin = fwhm; |
---|
45 | this->itsPA = 0.; |
---|
46 | } |
---|
47 | |
---|
48 | void Beam::define(float maj, float min, float pa) |
---|
49 | { |
---|
50 | this->itsMaj = maj; |
---|
51 | this->itsMin = min; |
---|
52 | this->itsPA = pa; |
---|
53 | this->calculateArea(); |
---|
54 | } |
---|
55 | |
---|
56 | void Beam::setFWHM(float fwhm) |
---|
57 | { |
---|
58 | this->itsMaj = fwhm; |
---|
59 | this->itsMin = fwhm; |
---|
60 | this->itsPA = 0.; |
---|
61 | this->calculateArea(); |
---|
62 | } |
---|
63 | |
---|
64 | void Beam::setArea(float area) |
---|
65 | { |
---|
66 | this->itsArea = area; |
---|
67 | this->areaToFWHM(); |
---|
68 | } |
---|
69 | |
---|
70 | |
---|
71 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.