IO¶
blipss.io.read_blimpy_data
¶
Utilities for loading blimpy-compatible filterbank and HDF5 data files
read_waterfall_file(file_path, max_memory_gb)
¶
Load a .h5 or .fil file into a blimpy Waterfall object.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
file_path
|
Path | str
|
Path to the .h5 or .fil data file to load |
required |
max_memory_gb
|
float
|
Maximum data size in GB permitted in memory |
required |
Returns:
| Type | Description |
|---|---|
Waterfall
|
Blimpy Waterfall object containing the data file contents |
Source code in blipss/io/read_blimpy_data.py
8 9 10 11 12 13 14 15 16 17 18 19 | |
blipss.io.read_candidates
¶
Read utilities for FFA candidate detection CSV files.
read_candidates_csv(csv_path)
¶
Read FFA candidate detections previously written by write_candidates_csv.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
csv_path
|
Path
|
Path to a candidate CSV file with |
required |
Returns:
| Type | Description |
|---|---|
NDArray[intp]
|
Tuple of (channels, radiofreqs_MHz, phase_bins, boxcar_widths, periods, snrs, flags) |
NDArray[floating]
|
arrays, one entry per candidate row in file order. |
Raises:
| Type | Description |
|---|---|
ValueError
|
When the file header is missing one of |
Source code in blipss/io/read_candidates.py
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 | |
blipss.io.read_compared_candidates
¶
Read utilities for cross-file candidate comparison output files.
read_compared_candidates_csv(csv_path)
¶
Read cross-file candidate comparison results previously written by write_compared_candidates_csv.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
csv_path
|
Path
|
Path to a comparison CSV file with |
required |
Returns:
| Type | Description |
|---|---|
NDArray[intp]
|
Tuple of (channels, radiofreqs_MHz, phase_bins, boxcar_widths, periods, snrs, codes) |
NDArray[floating]
|
arrays, one entry per candidate row in file order. |
Raises:
| Type | Description |
|---|---|
ValueError
|
When the file is missing one of |
Source code in blipss/io/read_compared_candidates.py
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 | |
blipss.io.read_yaml_config
¶
Routines for reading YAML config files
load_yaml_config(config_path)
¶
Read a YAML config file and return its contents as a dictionary.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config_path
|
Path
|
Path to the YAML config file |
required |
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
Dictionary containing the parsed YAML config |
Raises:
| Type | Description |
|---|---|
FileNotFoundError
|
When config_path does not point to an existing file |
TypeError
|
When the file is empty or its top-level structure is not a mapping |
Source code in blipss/io/read_yaml_config.py
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | |
blipss.io.write_candidates
¶
Write utilities for FFA candidate detection output files.
write_candidates_csv(output_path, freqs_MHz, cand_channels, cand_periods, cand_snrs, cand_phase_bins, cand_boxcar_widths, cand_flags, start_ch)
¶
Write FFA candidate detections to a CSV file sorted by descending S/N.
Rows are ordered from highest to lowest S/N. Column layout follows
FFA_CANDIDATE_CSV_COLUMNS.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
output_path
|
Path
|
Destination path for the output CSV file. |
required |
freqs_MHz
|
NDArray[floating]
|
Radio frequencies in MHz for all channels in the processed band. |
required |
cand_channels
|
NDArray[intp]
|
Absolute channel indices of each candidate detection. |
required |
cand_periods
|
NDArray[floating]
|
Best-fit periods in seconds for each candidate. |
required |
cand_snrs
|
NDArray[floating]
|
Peak signal-to-noise ratios for each candidate. |
required |
cand_phase_bins
|
NDArray[uint]
|
Number of phase bins in the folded profile for each candidate. |
required |
cand_boxcar_widths
|
NDArray[uint]
|
Best-fit boxcar widths in phase bins for each candidate. |
required |
cand_flags
|
NDArray[str_]
|
Harmonic classification label for each candidate. |
required |
start_ch
|
int
|
Absolute channel index of the first channel in the processed sub-band,
used to map |
required |
Source code in blipss/io/write_candidates.py
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 | |
blipss.io.write_compared_candidates
¶
Write utilities for cross-file candidate comparison output files.
write_compared_candidates_csv(output_path, channels, radiofreqs, phase_bins, boxcar_widths, periods, snrs, codes)
¶
Write cross-file candidate comparison results to a CSV file.
Rows are written in the order given. Column layout follows COMPARE_CANDS_CSV_COLUMNS.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
output_path
|
Path
|
Destination path for the output CSV file. |
required |
channels
|
NDArray[intp]
|
Spectral channel index of each candidate. |
required |
radiofreqs
|
NDArray[floating]
|
Radio frequency (MHz) of each candidate. |
required |
phase_bins
|
NDArray[uint]
|
Number of phase bins in the folded profile for each candidate. |
required |
boxcar_widths
|
NDArray[uint]
|
Best-fit boxcar widths in phase bins for each candidate. |
required |
periods
|
NDArray[floating]
|
Best-fit periods in seconds for each candidate. |
required |
snrs
|
NDArray[floating]
|
Peak signal-to-noise ratios for each candidate. |
required |
codes
|
NDArray[str_]
|
Per-file binary detection code string for each candidate. |
required |
Source code in blipss/io/write_compared_candidates.py
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | |
blipss.io.write_filterbank
¶
Filterbank write utilities for both synthetic and real-data pipelines.
Two write paths are provided:
-
write_filterbank: writes a raw numpy array produced by the simulate_data pipeline directly to a.filfile by serialising a sigproc header followed by the raw float32 samples. -
write_waterfall: writes a blimpyWaterfallobject produced by the inject_signal pipeline to either a.filor.h5file, delegating to the appropriate blimpy serialiser based on the output file extension.
Helper utilities¶
build_sigproc_header
Constructs the sigproc header dict required by write_filterbank.
build_sigproc_header(sim, header_params)
¶
Construct the sigproc header dictionary from simulation and metadata parameters.
This is a pre-write step for the simulate_data pipeline. The resulting
dict is passed directly to write_filterbank.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
sim
|
SimulationProperties
|
Filterbank dimension and frequency/time axis parameters. |
required |
header_params
|
OptionalHeaderParameters
|
Optional observational metadata (source name, start MJD). |
required |
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
Dictionary of sigproc header key-value pairs compatible with |
dict[str, Any]
|
|
Source code in blipss/io/write_filterbank.py
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 | |
write_filterbank(data, header, output_dir, basename)
¶
Write a numpy data array and a sigproc header to a .fil filterbank file.
Used by the simulate_data pipeline, where the full data array is generated in memory. The array is serialised as contiguous float32 samples immediately after the binary sigproc header.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
NDArray[floating]
|
Array of shape |
required |
header
|
dict[str, Any]
|
Sigproc header dictionary, as returned by |
required |
output_dir
|
Path
|
Directory in which the output file is created; created automatically if it does not exist. |
required |
basename
|
str
|
Filename stem; the |
required |
Source code in blipss/io/write_filterbank.py
81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 | |
write_waterfall(wat, output_path)
¶
Write a blimpy Waterfall object to disk, dispatching on file extension.
Used by the inject_signal pipeline, where signal injection modifies an
existing Waterfall object loaded from a real-data filterbank. The
original header is preserved intact; only wat.data is expected to have
been updated before calling this function.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
wat
|
Waterfall
|
Blimpy |
required |
output_path
|
Path
|
Full output file path including a supported extension
( |
required |
Raises:
| Type | Description |
|---|---|
ValueError
|
When the file extension is not in |
Source code in blipss/io/write_filterbank.py
111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 | |