Python Extension Modules
Functions
-
std::pair<Eigen::MatrixXd, Eigen::MatrixXd> generate_single(const Eigen::Vector3d &rot_axis, double mag_axis_tilt, const std::vector<double> &rot_phases, std::vector<double> freq_channel, std::string tag, double signal_time_bin, const std::string ¶m_folder, const std::string &payload_folder, double antenna_sensitivity, double prob_nbrfi, double prob_bbrfi, double scale_direction_randomness, bool remove_drift_effect, bool randomize, const std::vector<spark_pattern_generator::spark> &init_spark_list)
Generates simulated pulsar flux data and corresponding noisy time-frequency graph.
This function orchestrates the generation of synthetic pulsar signals using a spark-pattern-based model. It simulates pulsar flux over time and frequency channels, incorporating various effects such as drift, RFI (Radio Frequency Interference), and randomization.
- Parameters:
rot_axis – The rotation axis of the pulsar (3D unit vector).
mag_axis_tilt – The tilt angle (in radians) between the rotation and magnetic axes.
rot_phases – List of rotation phase samples for the pulsar signal.
freq_channel – List of frequency channels to simulate.
tag – String identifier for the signal (used for metadata or filenames).
signal_time_bin – Duration of each time bin in the simulation (in seconds).
param_folder – Path to the folder containing simulation parameters.
payload_folder – Path to the folder where generated data or intermediate outputs may be stored.
antenna_sensitivity – Sensitivity factor of the receiving antenna.
prob_nbrfi – Probability of narrow-band RFI contamination.
prob_bbrfi – Probability of broad-band RFI contamination.
scale_direction_randomness – Randomness factor for emission direction variations.
remove_drift_effect – If true, disables drift effects in the spark model.
randomize – If true, applies randomization to various signal properties.
init_spark_list – Initial list of spark configurations to seed the generator.
- Returns:
std::pair<Eigen::MatrixXd, Eigen::MatrixXd>
First matrix: Total noise contribution over time-frequency bins.
Second matrix: Simulated pulsar flux data over time-frequency bins.
-
PYBIND11_MODULE(_m_data_generation_module, m)
Functions
-
PYBIND11_MODULE(dt_calc_module, m)
Functions
-
std::tuple<std::vector<Eigen::Vector3d>, std::vector<Eigen::Vector3d>, std::vector<Eigen::Vector3d>> update_pulsar_state_vectors(Eigen::Vector3d rot_axis, double mag_axis_tilt, double rot_phase)
Computes and returns updated state vectors of a pulsar at a given rotational phase.
This function updates and returns three orthonormal vector bases related to the pulsar’s rotation and magnetic frames. It uses the input rotation axis, magnetic axis tilt, and current rotational phase to compute:
The magnetic frame basis at zero phase (
mag_frame_basis_att0)The rotation frame basis (
rot_frame_basis)The magnetic frame basis at the specified phase (
mag_frame_basis)
These vectors are useful for simulating pulsar orientation and magnetic geometry over time.
- Parameters:
rot_axis – A 3D unit vector representing the rotation axis of the pulsar.
mag_axis_tilt – The angle (in radians) between the rotation and magnetic axes.
rot_phase – The current rotational phase of the pulsar (in radians or cycles).
- Returns:
std::tuple<std::vector<Eigen::Vector3d>, std::vector<Eigen::Vector3d>, std::vector<Eigen::Vector3d>> A tuple containing:
Magnetic frame basis at phase 0 (vector set)
Rotation frame basis (vector set)
Magnetic frame basis at the given rotational phase (vector set)
-
PYBIND11_MODULE(_m_pulsar_animator, m)
Functions
-
std::tuple<Eigen::MatrixXd, Eigen::MatrixXd, std::map<std::string, int>> randomize_antenna_output(std::vector<double> freqs, Eigen::MatrixXd dataframe, std::vector<double> rot_phases, double sensitivity = 0.1, double prob_nbrfi = 1., double prob_bbrfi = 1.)
Simulates antenna output with randomized effects, including pulsar signal and RFI contamination.
This function processes an input pulsar signal (represented as a time-frequency matrix) and applies simulated antenna effects, such as narrow-band and broad-band radio frequency interference (RFI), as well as intrinsic noise. The output includes:
A matrix of total noise values across time and frequency bins
A matrix of total flux (including signal and noise)
A summary map with counts of different signal sources
This is useful for generating realistic synthetic data for testing signal processing algorithms.
- Parameters:
freqs – A vector of frequency channels.
dataframe – Input data matrix (typically containing simulated pulsar flux).
rot_phases – Vector of rotation phases for signal generation.
sensitivity – Antenna sensitivity factor (default: 0.1).
prob_nbrfi – Probability of narrow-band RFI presence (default: 1.0).
prob_bbrfi – Probability of broad-band RFI presence (default: 1.0).
- Returns:
std::tuple<Eigen::MatrixXd, Eigen::MatrixXd, std::map<std::string, int>> A tuple containing:
Matrix of total noise contributions
Matrix of total flux values (signal + noise)
Map summarizing the count of signal components:
”Pulsar”: number of pulsar contributions
”NBRFI”: number of narrow-band RFI instances
”BBRFI”: number of broad-band RFI instances
-
PYBIND11_MODULE(_m_signal_detection_module, m)