setup_profiles.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/setup_profiles.h
10 
11 #ifndef __Pulsar_setup_profiles_h
12 #define __Pulsar_setup_profiles_h
13 
15 template<typename I, typename P>
16 void setup_profiles_dat (I subint, P& profiles)
17 {
18  const unsigned npol = subint->get_npol ();
19  const unsigned nchan = subint->get_nchan ();
20 
21  profiles.resize (npol * nchan);
22 
23  for (unsigned ipol=0; ipol<npol; ipol++)
24  for (unsigned ichan=0; ichan<nchan; ichan++)
25  profiles[ipol*nchan + ichan] = subint->get_Profile (ipol, ichan);
26 }
27 
29 template<class E, typename I, typename P>
30 void setup_profiles (I subint, P& profiles)
31 {
32  E* ext = subint->get_Profile(0,0)->template get<E>();
33  if (!ext)
34  throw Error (InvalidState, "setup_profiles<Extension>",
35  "first profile is missing required Extension");
36 
37  const unsigned naux = ext->get_size();
38  const unsigned nchan = subint->get_nchan ();
39 
40  profiles.resize (naux * nchan);
41 
42  for (unsigned ichan=0; ichan<nchan; ichan++)
43  {
44  ext = subint->get_Profile(0,ichan)->template get<E>();
45  if (!ext)
46  throw Error (InvalidState, "setup_profiles<Extension>",
47  "profile[%u] is missing required Extension", ichan);
48 
49  for (unsigned iaux=0; iaux<naux; iaux++)
50  profiles[iaux*nchan + ichan] = ext->get_Profile (iaux);
51  }
52 }
53 
54 #endif
virtual unsigned get_nbin() const
Get the number of pulsar phase bins used.
Definition: BasicArchive.C:126
virtual unsigned get_npol() const
Get the number of frequency channels used.
Definition: BasicArchive.C:102
virtual unsigned get_nchan() const
Get the number of frequency channels used.
Definition: BasicArchive.C:114
bool verbose
Definition: timer++.C:25
static unsigned verbose
A verbosity flag that can be set for debugging purposes.
Definition: IntegrationManager.h:38

Generated using doxygen 1.8.17