1 | #include <duchamp/FitsIO/WriteBaselineArray.hh> |
---|
2 | #include <duchamp/FitsIO/WriteArray.hh> |
---|
3 | #include <duchamp/duchamp.hh> |
---|
4 | #include <duchamp/Cubes/cubes.hh> |
---|
5 | #include <fitsio.h> |
---|
6 | |
---|
7 | namespace duchamp { |
---|
8 | |
---|
9 | WriteBaselineArray::WriteBaselineArray(): |
---|
10 | WriteArray() |
---|
11 | { |
---|
12 | this->itsBitpix=FLOAT_IMG; |
---|
13 | } |
---|
14 | |
---|
15 | WriteBaselineArray::WriteBaselineArray(Cube *cube): |
---|
16 | WriteArray(cube,FLOAT_IMG) |
---|
17 | { |
---|
18 | } |
---|
19 | |
---|
20 | WriteBaselineArray::WriteBaselineArray(const WriteBaselineArray &other) |
---|
21 | { |
---|
22 | this->operator=(other); |
---|
23 | } |
---|
24 | |
---|
25 | WriteBaselineArray::WriteBaselineArray(const WriteArray &base) |
---|
26 | { |
---|
27 | this->operator=(base); |
---|
28 | } |
---|
29 | |
---|
30 | WriteBaselineArray& WriteBaselineArray::operator= (const WriteBaselineArray& other) |
---|
31 | { |
---|
32 | if(this==&other) return *this; |
---|
33 | ((WriteArray &) *this) = other; |
---|
34 | return *this; |
---|
35 | } |
---|
36 | |
---|
37 | WriteBaselineArray& WriteBaselineArray::operator= (const WriteArray& base) |
---|
38 | { |
---|
39 | if(this==&base) return *this; |
---|
40 | ((WriteArray &) *this) = base; |
---|
41 | return *this; |
---|
42 | } |
---|
43 | |
---|
44 | OUTCOME WriteBaselineArray::writeHeader() |
---|
45 | { |
---|
46 | /// @details |
---|
47 | /// A simple function that writes all the necessary keywords and comments |
---|
48 | /// to the FITS header pointed to by this->itsFptr. |
---|
49 | /// The keyword names and comments are taken from duchamp.hh |
---|
50 | |
---|
51 | OUTCOME result=SUCCESS; |
---|
52 | int status = 0; |
---|
53 | if(fits_write_history(this->itsFptr, (char *)header_baselineHistory.c_str(), &status)){ |
---|
54 | duchampFITSerror(status,"writeBaselineArray","Error : header I/O"); |
---|
55 | result=FAILURE; |
---|
56 | } |
---|
57 | status = 0; |
---|
58 | if(fits_write_history(this->itsFptr, (char *)header_baselineHistory_input.c_str(),&status)){ |
---|
59 | duchampFITSerror(status,"writeBaselineArray","Error : header I/O"); |
---|
60 | result=FAILURE; |
---|
61 | } |
---|
62 | status = 0; |
---|
63 | if(fits_write_history(this->itsFptr, (char *)this->itsCube->pars().getImageFile().c_str(), &status)){ |
---|
64 | duchampFITSerror(status,"writeBaselineArray","Error : header I/O"); |
---|
65 | result=FAILURE; |
---|
66 | } |
---|
67 | |
---|
68 | if(this->itsCube->pars().getFlagSubsection()){ |
---|
69 | status = 0; |
---|
70 | if(fits_write_comment(this->itsFptr,(char *)header_baselineSubsection_comment.c_str(),&status)){ |
---|
71 | duchampFITSerror(status,"writeBaselineArray","Error : header I/O"); |
---|
72 | result=FAILURE; |
---|
73 | } |
---|
74 | status = 0; |
---|
75 | if(fits_write_key(this->itsFptr, TSTRING, (char *)keyword_subsection.c_str(), |
---|
76 | (char *)this->itsCube->pars().getSubsection().c_str(), |
---|
77 | (char *)comment_subsection.c_str(), &status)){ |
---|
78 | duchampFITSerror(status,"writeBaselineArray","Error : header I/O"); |
---|
79 | result=FAILURE; |
---|
80 | } |
---|
81 | } |
---|
82 | |
---|
83 | return result; |
---|
84 | |
---|
85 | } |
---|
86 | |
---|
87 | OUTCOME WriteBaselineArray::writeData() |
---|
88 | { |
---|
89 | |
---|
90 | OUTCOME result = this->writeToFITS_flt(this->itsCube->getSize(), this->itsCube->getBaseline()); |
---|
91 | |
---|
92 | return result; |
---|
93 | |
---|
94 | } |
---|
95 | |
---|
96 | } |
---|
97 | |
---|