ProfileColumn.h
1 //-*-C++-*-
2 /***************************************************************************
3  *
4  * Copyright (C) 2009 by Willem van Straten
5  * Licensed under the Academic Free License version 2.1
6  *
7  ***************************************************************************/
8 
9 // psrchive/Base/Formats/PSRFITS/Pulsar/ProfileColumn.h
10 
11 #ifndef __Pulsar_ProfileColumn_h
12 #define __Pulsar_ProfileColumn_h
13 
14 #include "Pulsar/Config.h"
15 #include <fitsio.h>
16 
17 namespace Pulsar {
18 
19  class Profile;
20 
22 
23  class ProfileColumn : public Reference::Able {
24 
25  public:
26 
27  static Option<bool> output_floats;
28 
30  ProfileColumn ();
31 
33  void set_fitsfile (fitsfile* fptr);
34 
36  void set_data_colname (const std::string&);
37 
39  unsigned get_data_colnum ();
40 
42  void set_offset_colname (const std::string&);
43 
45  unsigned get_offset_colnum ();
46 
48  void set_scale_colname (const std::string&);
49 
51  unsigned get_scale_colnum ();
52 
54  void set_nbin (unsigned);
55 
57  void set_nchan (unsigned);
58 
60  void set_nprof (unsigned);
61 
63  void resize ();
64 
66  void resize_floats ();
67 
69  unsigned get_nrow () const { return nrow; }
70 
72  void create (unsigned start_column);
73 
75  void unload (int row, const std::vector<const Profile*>&);
76 
78  void unload_floats (int row, const std::vector<const Profile*>&);
79 
81  void load (int row, const std::vector<Profile*>&);
82 
83  bool verbose;
84 
85  protected:
86 
87  fitsfile* fptr;
88 
89  std::string data_colname;
90  std::string offset_colname;
91  std::string scale_colname;
92 
93  int data_colnum;
94  int offset_colnum;
95  int scale_colnum;
96 
97  unsigned nbin, nchan, nprof;
98  unsigned nrow;
99 
101  void reset ();
102 
104  int get_colnum (const std::string& name);
105 
106  template<typename T, typename C>
107  void load_amps (int row, C&, bool must_have_scloffs = true);
108  };
109 
110 }
111 
112 #endif
Warning warning
Warning messages filter.
Definition: Pulsar.C:12
ProfileColumn()
Default constructor.
Definition: ProfileColumn.C:48
void load(int row, const std::vector< Profile * > &)
Load the given vector of profiles.
Definition: ProfileColumn.C:489
void resize()
Resize the columns.
Definition: ProfileColumn.C:244
void create(unsigned start_column)
Insert the columns and resize.
Definition: ProfileColumn.C:137
unsigned get_data_colnum()
Get the index of the data column.
Definition: ProfileColumn.C:73
void set_data_colname(const std::string &)
Set the name of the data column.
Definition: ProfileColumn.C:66
void reset()
reset the column indeces
Definition: ProfileColumn.C:41
unsigned get_nrow() const
Get the number of rows required to unload data (after resize)
Definition: ProfileColumn.h:74
void resize_floats()
Resize the columns for floating point output.
Definition: ProfileColumn.C:200
void unload(int row, const std::vector< const Profile * > &)
Unload the given vector of profiles.
Definition: ProfileColumn.C:365
void set_fitsfile(fitsfile *fptr)
Set the fitsfile to/from which data are written/read.
Definition: ProfileColumn.C:59
void set_nchan(unsigned)
Set the number of frequency channels.
Definition: ProfileColumn.C:120
void set_nbin(unsigned)
Set the number of phase bins.
Definition: ProfileColumn.C:114
void set_offset_colname(const std::string &)
Set the name of the offset column.
Definition: ProfileColumn.C:82
void set_scale_colname(const std::string &)
Set the name of the scale column.
Definition: ProfileColumn.C:98
void set_nprof(unsigned)
Set the number of profiles in each frequency channel.
Definition: ProfileColumn.C:126
unsigned get_scale_colnum()
Get the index of the data column.
Definition: ProfileColumn.C:105
int get_colnum(const std::string &name)
Get the column number for the specified column name.
Definition: ProfileColumn.C:183
void unload_floats(int row, const std::vector< const Profile * > &)
Unload the given vector of profiles as single-precision floats.
Definition: ProfileColumn.C:329
Defines the PSRCHIVE library.
Definition: CalSource.h:17
unsigned get_offset_colnum()
Get the index of the data column.
Definition: ProfileColumn.C:89

Generated using doxygen 1.8.17