Gating Specifications¶
-
class gateSpec : public kotekan::kotekanLogging¶
Base class for specifying a gated data accumulation.
Subclasses of need to implement weight_function to return a function which given the start and end times of a frame of its frame, as well as it’s frequency, produces a weight with which it should be accumulated.
- Author
Richard Shaw, Tristan Pinsonneault-Marotte
Subclassed by pulsarSpec, uniformSpec
Public Functions
-
gateSpec(const std::string &name, const kotekan::logLevel log_level)¶
Create a new gateSpec.
- Parameters:
name – Name of the gated dataset.
log_level – Kotekan log level for any logging generated by the gateSpec.
-
virtual ~gateSpec() = 0¶
-
virtual bool update_spec(nlohmann::json &json) = 0¶
A callback to update the gating specification.
- Parameters:
json – A json object with the updated config.
- Returns:
Did the config apply successfully.
-
virtual std::function<float(timespec, timespec, float)> weight_function(timespec t) const = 0¶
Get a function/closure to calculate the weights for a subsample.
Note
This must return a closure that captures by value such that its lifetime can be longer than the gateSpec object that generated it.
- Parameters:
t – The start time of this frame.
- Returns:
A function to calculate the weights.
-
inline const bool &enabled() const¶
Is this enabled at the moment?
- Returns:
True if gating for this spec is enabled.
-
inline const std::string &name() const¶
Get the name of the gated dataset.
- Returns:
Name of the gated dataset.
-
inline const std::string &type() const¶
Get the name of the gating type.
- Returns:
Name of the gating type.
-
inline virtual nlohmann::json to_dm_json() const¶
Get a description of the spec for the dataset manager.
Should be re-implemented by subclasses, and include information beyond the type of the gating (the type is captured separately).
- Returns:
Serialized config.
-
class uniformSpec : public gateSpec¶
Uniformly weight all data.
Note
This is used to implement the nominal visibility dataset. It does not actually gate.
Public Functions
-
uniformSpec(const std::string &name, const kotekan::logLevel log_level)¶
Create a uniform weighted dataset.
-
virtual bool update_spec(nlohmann::json &json) override¶
Update from json config. Has no effect.
-
virtual std::function<float(timespec, timespec, float)> weight_function(timespec t) const override¶
Return the weight calculation function.
- Parameters:
t – The start time of this frame.
-
uniformSpec(const std::string &name, const kotekan::logLevel log_level)¶
-
class pulsarSpec : public gateSpec¶
Pulsar gating.
Config message must contain:
- Param enabled:
Bool. Is the gating enabled or not.
- Param pulsar_name:
String. Name of the pulsar.
- Param dm:
Float. Dispersion measure in pc/cm^3.
- Param rot_freq:
Float. Rotational frequency in Hz.
- Param pulse_width:
Float. Width of pulse in s.
- Param segment:
Float. Length of polyco segments in s.
- Param t_ref:
Array of floats. Reference times (MJD) for solution segment. Should be close to the observing time.
- Param phase_ref:
Array of floats. Phases of pulsar at t_ref.
- Param coeff:
Array of array of floats. Polyco coefficients for every timing solution segment.
Public Functions
-
inline pulsarSpec(const std::string &name, const kotekan::logLevel log_level)¶
Create a pulsar spec.
-
virtual bool update_spec(nlohmann::json &json) override¶
Update the gating from a json message.
-
virtual std::function<float(timespec, timespec, float)> weight_function(timespec t) const override¶
Return a closure te calculate the weigths.
- Parameters:
t – The start time of this frame.
-
virtual nlohmann::json to_dm_json() const override¶
Return JSON config for the dM.
- Returns:
JSON config.