Mower.h
1 //-*-C++-*-
2 /***************************************************************************
3  *
4  * Copyright (C) 2012 by Willem van Straten
5  * Licensed under the Academic Free License version 2.1
6  *
7  ***************************************************************************/
8 
9 // psrchive/More/RFIMitigation/Pulsar/MADLM.h
10 
11 #ifndef __Pulsar_MADLM_h
12 #define __Pulsar_MADLM_h
13 
14 #include "Pulsar/Transformation.h"
15 #include "Pulsar/Integration.h"
16 
17 #include "TextInterface.h"
18 #include "Functor.h"
19 
20 namespace Pulsar {
21 
23 
24  class Mower : public Transformation<Integration> {
25 
26  public:
27 
29  Mower ();
30 
33 
34  // Text interface to the Mower class
35  class Interface : public TextInterface::To<Mower> {
36  public:
37  Interface (Mower* = 0);
38  };
39 
41  void transform (Integration*);
42 
44  virtual void set_threshold (float madm);
45  float get_threshold () const;
46 
48  virtual void set_median_smoothing (float turns);
49  float get_median_smoothing () const;
50 
52  virtual void set_broadband (bool);
53 
55  virtual void set_prune (const PhaseWeight* prune_mask);
56  const PhaseWeight* get_prune () const;
57 
59  virtual void add_precondition( Functor< bool(Profile*,PhaseWeight*) > );
60 
61  protected:
62 
65 
68 
70  virtual bool build_mask (Profile* profile);
71 
73  virtual void compute (PhaseWeight* mask, const Profile* difference) = 0;
74 
77 
79  float cutoff_threshold;
80 
82  bool broadband;
83 
85  std::vector< Functor< bool(Profile*,PhaseWeight*) > > precondition;
86 
87  };
88 
89 }
90 
91 #endif
void set_dedisperse(bool)
Correct dispersion before integrating, if necessary.
Definition: FrequencyIntegrate.C:26
virtual void set_median_smoothing(float turns)
Set the size of the window used during median smoothing.
Definition: Mower.C:48
virtual bool build_mask(Profile *profile)
Create mask and return true if all preconditions are satisfied.
Definition: Mower.C:82
Integrates frequency channels in an Integration.
Definition: FrequencyIntegrate.h:46
Stores a weight for each Profile phase bin.
Definition: PhaseWeight.h:29
void resize(unsigned nbin)
Resize the weights array.
Definition: PhaseWeight.h:67
Any quantity recorded as a function of pulse phase.
Definition: Profile.h:45
unsigned get_nbin() const
Return the number of bins.
Definition: ProfileAmps.h:50
std::vector< Functor< bool(Profile *, PhaseWeight *) > > precondition
Preconditions.
Definition: Mower.h:95
Reference::To< const PhaseWeight > prune
Specific points to be pruned.
Definition: Mower.h:77
virtual void set_prune(const PhaseWeight *prune_mask)
If set, mow only the points flagged in the prune mask.
Definition: Mower.C:63
Array of Profiles integrated over the same time interval.
Definition: Integration.h:37
Replaces impulsive DM=0 spikes with randomly selected noise.
Definition: Mower.h:29
void set_turns(float)
Set the width of the smoothing window in turns.
Definition: Smooth.C:23
virtual void add_precondition(Functor< bool(Profile *, PhaseWeight *) >)
One or more preconditions can be added.
Definition: Mower.C:75
virtual void set_broadband(bool)
If set, search for spikes in fscrunched (DM=0) total.
Definition: Mower.C:58
bool broadband
Search for spikes in fscrunch (DM=0) total.
Definition: Mower.h:92
const std::string get_message() const
Reference::To< PhaseWeight > mowed
Points to be mowed.
Definition: Mower.h:74
Defines the PSRCHIVE library.
Definition: CalSource.h:17
void transform(Integration *)
Set the Profile from which baseline PhaseWeight will be computed.
Definition: Mower.C:150
virtual void compute(PhaseWeight *mask, const Profile *difference)=0
Find the spikes in median smoothed difference and flag them in mask.
virtual TextInterface::Parser * get_interface()
Get the text interface to the mower attributes.
Definition: Mower.C:235
Mower()
Default constructor.
Definition: Mower.C:25
float cutoff_threshold
Cutoff threshold.
Definition: Mower.h:89
virtual void set_threshold(float madm)
Set the threshold above which samples are mown.
Definition: Mower.C:38
float median_smoothing_turns
Size of median smoothing window in turns.
Definition: Mower.h:86
Smooths a Profile using the median over a boxcar.
Definition: SmoothMedian.h:29

Generated using doxygen 1.8.17