ArchiveComparisons.h
1 //-*-C++-*-
2 /***************************************************************************
3  *
4  * Copyright (C) 2021 by Willem van Straten
5  * Licensed under the Academic Free License version 2.1
6  *
7  ***************************************************************************/
8 
9 // psrchive/More/General/Pulsar/ArchiveComparisons.h
10 
11 #ifndef __ArchiveComparisons_h
12 #define __ArchiveComparisons_h
13 
14 #include "Pulsar/ArchiveStatistic.h"
15 #include "Pulsar/ScrunchFactor.h"
16 
17 #include "ndArray.h"
18 
19 class BinaryStatistic;
20 class UnaryStatistic;
21 
22 namespace Pulsar {
23 
24  class CompareWith;
25 
26  class ArchiveComparisons : public Identifiable::Proxy<ArchiveStatistic>
27  {
28 
29  public:
30 
31  ArchiveComparisons (BinaryStatistic*);
32 
33  void set_Archive (const Archive*);
34 
35  double get ();
36 
37  class Interface;
38 
39  TextInterface::Parser* get_interface ();
40 
41  ArchiveComparisons* clone () const;
42 
43  const std::string& get_what () const { return what; }
44  void set_what (const std::string& t) { what = t; }
45 
46  const std::string& get_way () const { return way; }
47  void set_way (const std::string& t) { way = t; }
48 
50  void set_compute_subint (const std::vector<bool>& flags)
51  { compute_subint = flags; }
52 
54  void set_compute_chan (const std::vector<bool>& flags)
55  { compute_chan = flags; }
56 
58  void set_bscrunch (const ScrunchFactor& f);
59 
61  const ScrunchFactor get_bscrunch () const { return bscrunch_factor; }
62 
64  void set_setup_Archive (const Archive*);
65 
67  /* Not all archive comparisons require a global set up */
68  bool get_setup ();
69 
70  protected:
71 
74 
77 
79  ndArray<2,double> result;
80 
82  std::vector<bool> compute_subint;
83 
85  std::vector<bool> compute_chan;
86 
88  ScrunchFactor bscrunch_factor;
89 
90  // what to compare
91  std::string what;
92  // dimension along which to compare
93  std::string way;
94 
95  void build ();
96  bool built;
97 
98  void build_compare ();
99  void init_compare (const Archive* arch);
100  };
101 
102 }
103 
104 #endif
105 
void bscrunch(Container *, const ScrunchFactor &)
Integrate phase bins.
Definition: ScrunchFactor.h:116
void set_removed(bool flag=true)
void update_model()
Create a new predictor and align the Integrations to the new model.
Definition: Archive_update_model.C:31
Archive * extract(std::vector< unsigned > &subints) const
Return pointer to a new instance with only the specified subints.
Definition: Archive_extract.C:18
bool calibrator_match(const Archive *arch, std::string &reason) const
Test if arch matches (enough for a pulsar - calibrator match)
Definition: Archive_match.C:47
Warning warning
Warning messages filter.
Definition: Pulsar.C:12
Integration * use_Integration(Integration *)
Return the given Integration ready for use.
Definition: Archive_init_Integration.C:18
void tscrunch_to_nsub(unsigned new_nsub)
Call tscrunch with the appropriate value.
Definition: Archive_tscrunch.C:32
void set_Index(unsigned subint, double i)
Set the custom index value associated with an Integration.
Definition: IntegrationOrder.C:77
static Configuration::Parameter< Policy > & get_policy()
void transform(Archive *)
The frequency integration operation.
Definition: TimeIntegrate.C:31
void convert_state(Signal::State state)
Convert data to the specified state.
Definition: Archive_convert_state.C:14
virtual void resize(unsigned nsubint, unsigned npol=0, unsigned nchan=0, unsigned nbin=0)
Resize the Integration vector with new_Integration instances.
Definition: Archive_resize.C:26
virtual void set_Archive(const Archive *)
Set the instance.
Definition: HasArchive.C:25
float rms_baseline(float dc=0.4)
Returns geometric mean of baseline RMS for each Integration.
Definition: Archive_rms_baseline.C:17
void remove_baseline()
Remove the baseline from all profiles.
Definition: Archive_remove_baseline.C:17
Combines an index value and integrate flag.
Definition: Index.h:24
void defaraday()
Correct the Faraday rotation of Q into U.
Definition: Archive_defaraday.C:26
void set_mixable(Match *)
The default baseline removal strategy.
Definition: Archive_match.C:95
Summarizes a comparison of each Profile with their sum.
Definition: CompareWithSum.h:28
const Match * get_mixable() const
Policy determines if data can be combined/integrated.
Definition: Archive_match.C:89
virtual MJD get_epoch() const =0
Get the epoch of the rising edge of bin zero.
virtual void resize(unsigned npol=0, unsigned nchan=0, unsigned nbin=0)
Set the dimensions of the data container.
Definition: Integration_resize.C:20
virtual bool match(const Archive *a, const Archive *b) const
Check that the selected attributes match.
Definition: ArchiveMatch.C:353
void remove_chan(unsigned first, unsigned last)
Delete the specified inclusive channel range from the Archive.
Definition: Archive_remove_chan.C:12
static bool verbose
flag controls the amount output to stderr by Integration methods
Definition: Integration.h:42
void fscrunch_to_nchan(unsigned new_nchan)
Call fscrunch with the appropriate value.
Definition: Archive_fscrunch.C:31
double get_centre_frequency(unsigned ichan) const
Get the Profile centre frequency attribute of the given channel.
Definition: Integration.C:359
const Integration * get_Integration(const Archive *data, Index subint)
Return the requested profile, cloning and integrating when needed.
Definition: Index.C:118
int config()
Definition: Tempo_config.C:26
virtual unsigned get_nsubint() const =0
Get the number of sub-integrations stored in the file.
void init_Integration(Integration *subint, bool check_phase=false)
Initialize an Integration to reflect Archive attributes.
Definition: Archive_init_Integration.C:29
Stores a weight for each Profile phase bin.
Definition: PhaseWeight.h:29
float find_max_phase() const
Returns the centre phase of the region with maximum total intensity.
Definition: Archive_find.C:72
std::string get_filename() const
void centre(double phase_offset=0.5)
Phase rotate pulsar Integrations so that pulse phase zero is centred.
Definition: Archive_centre.C:18
static Match * factory(T method)
Return a matching strategy based on the specified method.
Definition: ArchiveMatch.h:132
The primary interface to pulsar observational data.
Definition: Archive.h:45
bool processing_match(const Archive *arch, std::string &reason) const
Test if arch matches (enough for a pulsar - pulsar match)
Definition: Archive_match.C:40
static Archive * load(const std::string &name)
Factory returns a new instance loaded from filename.
Definition: Archive_load.C:28
void set_chan(Index _ichan)
Set the frequency channel.
Definition: HasArchive.C:84
void copy(const Archive &)
Copy all base class attributes, Extensions, and Integrations.
Definition: Archive_copy.C:24
void centre_max_bin(double phase_offset=0.5)
Phase rotate pulsar Integrations so centre the maximum amplitude.
Definition: Archive_centre_max_bin.C:16
static void set_verbosity(unsigned level)
Set the verbosity level (0 to 3)
Definition: Archive_verbose.C:19
void find_transitions(int &hi2lo, int &lo2hi, int &buffer) const
Find the transitions between high and low states in total intensity.
Definition: Archive_find.C:23
const Parameters * get_ephemeris() const
Return a pointer to the current archive ephemeris.
Definition: Archive.C:281
static bool verbose
flag controls the amount output to stderr by Profile methods
Definition: Profile.h:53
void update_centre_frequency()
Update the centre frequency.
Definition: Archive_update_centre_frequency.C:15
Type * release()
bool good_model(const Predictor *test_model) const
Returns true if the given model spans the Integration set.
Definition: Archive_good_model.C:23
Manages a combined scrunch factor or target dimension.
Definition: ScrunchFactor.h:25
Commmon statistics that can be derived from an Archive.
Definition: ArchiveStatistic.h:29
static unsigned verbose
Verbosity level.
Definition: Calibrator.h:40
Stores parameters used to correct dispersion in each Integration.
Definition: Dedisperse.h:24
virtual Integration * clone() const =0
Return a new copy of self.
virtual unsigned get_nchan() const =0
Get the number of frequency channels used.
bool has_model() const
Returns true if the Archive has a model.
Definition: Archive.h:330
void bscrunch(unsigned nscrunch)
Integrate pulse profiles in phase.
Definition: Archive_bscrunch.C:31
Stores parameters used to correct Faraday rotation in each Integration.
Definition: DeFaraday.h:24
virtual Integration * load_Integration(const char *filename, unsigned subint)=0
Load the specified Integration from filename, returning new instance.
const Match * get_processing_match() const
Policy determines if data were processed identically.
Definition: Archive_match.C:77
virtual void set_dedispersed(bool done=true)=0
Set the value to be returned by get_dedispersed.
virtual double get_centre_frequency() const =0
Get the centre frequency of the observation.
Integration * get_Integration(unsigned subint)
Return pointer to the specified Integration.
Definition: IntegrationManager.C:41
static Functor< void(Archive *) > remove_baseline_strategy
The default baseline removal strategy.
Definition: Archive.h:572
bool mixable(const Archive *arch, std::string &reason) const
Test if arch is mixable (enough for append)
Definition: Archive_match.C:29
static bool verbose
Array of Profiles integrated over the same time interval.
Definition: Integration.h:37
static List & get_registry()
unsigned size() const
void bscrunch_to_nbin(unsigned new_nbin)
Call bscrunch with the appropriate value.
Definition: Archive_bscrunch.C:16
Find the baseline from the total integrated total intensity profile.
Definition: RemoveBaseline.h:70
Policy used to determine if two archives match.
Definition: ArchiveMatch.h:25
MJD end_time() const
Return the MJD at the end of the last sub-integration.
Definition: Archive.C:308
double get_Index(unsigned subint) const
Get the custom index value associated with an Integration.
Definition: IntegrationOrder.C:68
PhaseWeight * baseline() const
Return a new PhaseWeight instance with the baseline phase bins masked.
Definition: Archive_baseline.C:11
Archive * total(bool tscrunch=true) const
Return pointer to a new fscrunched, tscrunched and pscrunched clone.
Definition: Archive_total.C:19
void set_ephemeris(const Parameters *ephemeris, bool update=true)
Install the given ephemeris and call update_model.
Definition: Archive_set_ephemeris.C:17
const Match * get_standard_match() const
Policy determines if a standard/template matches an observation.
Definition: Archive_match.C:53
std::string get_reason() const
Get the mismatch messages from the last call to the match method.
Definition: ArchiveMatch.h:48
void set_dispersion_measure(double dispersion_measure)
Set the dispersion measure.
Definition: Dedisperse.h:46
MJD start_time() const
Return the MJD at the start of the first sub-integration.
Definition: Archive.C:299
void rotate_phase(double phase)
Rotate each profile by phase.
Definition: Archive_rotate.C:18
virtual double get_bandwidth() const =0
Get the overall bandwidth of the observation.
void set_model(const Predictor *model, bool apply=true)
Install the given predictor and shift profiles to align.
Definition: Archive_set_model.C:14
void defaraday()
Remove Faraday rotation with respect to centre frequency.
Definition: Integration_defaraday.C:18
void resize_Integration(Integration *integration)
Provide Integration::resize access to Archive-derived classes.
Definition: Archive_resize.C:88
void resize(unsigned nsubint, unsigned npol=0, unsigned nchan=0, unsigned nbin=0)
Change the size of the index array.
Definition: IntegrationOrder.C:50
void set_reference_frequency(double MHz)
Set the reference frequency in MHz.
Definition: ColdPlasmaHistory.C:65
float find_min_phase(float dc=0.15) const
Returns the centre phase of the region with minimum total intensity.
Definition: Archive_find.C:56
void set_processing_match(Match *)
The default baseline removal strategy.
Definition: Archive_match.C:83
Integration * total() const
Return an orphaned pscrunched dedispersed fscrunched clone of self.
Definition: Integration_total.C:22
unsigned size() const
Return the size of the index array.
Definition: IntegrationOrder.C:58
void transform(Archive *)
Remove the baseline.
Definition: RemoveBaseline.C:31
void erase(unsigned i)
Erase the specified index.
Definition: IntegrationOrder.C:63
const Type * ptr() const
static bool verbose
void dedisperse()
Rotate the Profiles to remove dispersion delays b/w chans.
Definition: Archive_dedisperse.C:18
static unsigned verbose
A verbosity flag that can be set for debugging purposes.
Definition: IntegrationManager.h:38
void set_subint(Index _isubint)
Set the sub-integration.
Definition: HasArchive.C:62
const Predictor * get_model() const
Return a pointer to the current phase predictor.
Definition: Archive.C:290
virtual Parameters * clone() const=0
void stats(double *mean, double *variance=0, double *varmean=0, int bin_start=0, int bin_end=0) const
Calculates the mean, variance, and variance of the mean.
Definition: Profile_stats.C:27
Integrates sub-integrations in an Archive.
Definition: TimeIntegrate.h:45
void append(const Archive *archive)
Append the Integrations from the specifed archive.
Definition: Archive_append.C:20
void invint()
Transform Stokes I,Q,U,V into the polarimetric invariant interval.
Definition: Archive_invint.C:11
void fscrunch(unsigned nscrunch=0)
Integrate profiles in frequency.
Definition: Archive_fscrunch.C:17
const std::string get_message() const
State pscrunch(State state)
void set_calibrator_match(Match *)
The default baseline removal strategy.
Definition: Archive_match.C:71
Defines the PSRCHIVE library.
Definition: CalSource.h:17
const Profile * get_Profile(const Archive *data, Index subint, Index pol, Index chan)
Return the requested profile, cloning and integrating when needed.
Definition: Index.C:24
void rotate(double time)
Phase rotate each profile by time seconds.
Definition: Archive_rotate.C:12
void fold(unsigned nfold)
Integrate neighbouring sections of the pulse profiles.
Definition: Archive_fold.C:15
void pscrunch()
Integrate profiles in polarization.
Definition: Archive_pscrunch.C:16
virtual Predictor * clone() const=0
void unload(const char *filename=0) const
Write the archive to filename.
Definition: Archive_unload.C:36
void set_rotation_measure(double rotation_measure)
Set the rotation measure.
Definition: DeFaraday.h:46
void apply_model(Integration *subint, const Predictor *old=0)
Apply the current model to the Integration.
Definition: Archive_apply_model.C:26
void create_updated_model(bool clear_model)
Creates polynomials to span the Integration set.
Definition: Archive_update_model.C:109
const Match * get_calibrator_match() const
Policy determines if a calibrator matches an observation.
Definition: Archive_match.C:65
void find_peak_edges(int &rise, int &fall) const
Find the bins in which the total intensity exceeds a threshold.
Definition: Archive_find.C:40
bool standard_match(const Archive *arch, std::string &reason) const
Test if arch matches (enough for a pulsar - standard match)
Definition: Archive_match.C:34
virtual Phase phase(const MJD &t) const=0
virtual void set_range_policy(RangePolicy *rp)
Set the range division policy.
Definition: Integrate.h:57
Alternative ways of ordering Integration instances.
Definition: IntegrationOrder.h:29
virtual void erase(unsigned isubint)
Remove the specified sub-integration.
Definition: Archive_resize.C:94
Algorithms that combine Integration data.
Definition: TimeAppend.h:24
void transform(const Jones< float > &)
Perform the transformation on each polarimetric profile.
Definition: Archive_transform.C:15
double weighted_frequency(unsigned ichan, unsigned start, unsigned end) const
Computes the weighted channel frequency over an Integration interval.
Definition: Archive_weighted_frequency.C:23
Summarizes a comparison of each Profile with every other Profile.
Definition: CompareWithEachOther.h:26
static Option< bool > no_clobber
Default policy for overwriting archive files.
Definition: Archive.h:602
void set_standard_match(Match *)
The default baseline removal strategy.
Definition: Archive_match.C:59
void tscrunch(unsigned nscrunch=0)
Integrate profiles in time.
Definition: Archive_tscrunch.C:17
Archive * tscrunched() const
Return pointer to a new tscrunched clone.
Definition: Archive_tscrunched.C:18

Generated using doxygen 1.8.17