NuRadioReco.modules.io.LOFAR.rawTBBio_metadata module

This module reads in calibration metadata from file in the early phases of LOFAR. In the future this should be replaced by reading the metadata from the files.

Modified by Brian Hare for use with LOFAR for Lightning Imaging.

NuRadioReco.modules.io.LOFAR.rawTBBio_metadata.make_antennaID_filter(antenna_ids)[source]

For a list of antennaIDs, return a filter to filter data by antenna.

Notes

Only works for one station at a time. Assumes that the array you want to filter includes ALL antennas in the appropriate antenna set.

Examples

>>> getStationPhaseCalibration("CS001","LBA_OUTER",)
[ make_antennaID_filter(["002000001"]) ]
NuRadioReco.modules.io.LOFAR.rawTBBio_metadata.mapAntennasetKeyword(antenna_set)[source]

Ugly fix to map correct antenna names in input to wrong antenna names for metadata module.

NuRadioReco.modules.io.LOFAR.rawTBBio_metadata.getItrfAntennaPosition(station, antenna_set, metadata_dir)[source]

Returns the antenna positions of all the antennas in the station in ITRF coordinates for the specified antennaset. station can be the name or id of the station.

Parameters:
stationint or str

Name or id of the station. e.g. “CS302” or 142

antenna_set{LBA_INNER, LBA_OUTER, LBA_X, LBA_Y, LBA_SPARSE0, LBA_SPARSE1, HBA_0, HBA_1, HBA}

Antenna set used for this station

metadata_dir: str

Path to the directory containing the LOFAR static metadata.

NuRadioReco.modules.io.LOFAR.rawTBBio_metadata.getStationPositions(station, antenna_set, coordinate_system, metadata_dir)[source]

Returns the antenna positions of all the antennas in the station relative to the station center for the specified antenna set. station can be the name or id of the station.

Parameters:
stationint or str

Name or id of the station. e.g. “CS302” or 142

antenna_set{LBA_INNER, LBA_OUTER, LBA_X, LBA_Y, LBA_SPARSE0, LBA_SPARSE1, HBA_0, HBA_1, HBA}

Antenna set used for this station

coordinate_system{WGS84, ITRF}

The coordinate system to use when returning antenna positions (see also Notes section). metadata_dir : str Path to the directory containing the LOFAR static metadata.

Notes

For the coordinate system, when using “WGS84”, the function returns the postions as a Numpy array containing [lat, lon, alt] of antenna positions. Else, when using the ITRF coordinate system, is return the positions as [X, Y, Z].

NuRadioReco.modules.io.LOFAR.rawTBBio_metadata.convertITRFToLocal(itrfpos, metadata_dir, phase_center=None, ref_lat_lon=None, out=None)[source]
Parameters:
itrfposlist or np.ndarray

The ITRF positions as 1D numpy array, or list of positions as a 2D array

metadata_dir: str

Path to the directory containing the LOFAR static metadata.

phase_center: list or np.ndarray, default=None

The origin of the coordinate system, in ITRF. Default is the coordinates of station CS002.

ref_lat_lon: list or np.ndarray, default=None

The rotation of the coordinate system, i.e. the [lat, lon] (in degrees) on the Earth which defines “UP”. If not specified, the coordinates of CS002 will be used.

out: np.ndarray, default=None

If given, the output will be stored in this array. Otherwise, a new array will be created and returned. Cannot be same array as itrfpos

Notes

Function returns a 2D numpy array (even if input is 1D).

NuRadioReco.modules.io.LOFAR.rawTBBio_metadata.getStationPhaseCalibration(station, antenna_set, metadata_dir, file_location=None)[source]

Read phase calibration data for a station.

Parameters:
stationint or str

Name or id of the station. e.g. “CS302” or 142

antenna_set{LBA_INNER, LBA_OUTER, LBA_X, LBA_Y, LBA_SPARSE0, LBA_SPARSE1, HBA_0, HBA_1, HBA}

Antenna set used for this station

metadata_dirstr

Path to the directory containing the LOFAR static metadata.

file_locationstr, default=None

The path to the LOFAR calibration tables. If None, it is assumed to be in the /lofar/StaticMetaData/CalTables directory relative to xMetaData_directory.

Returns:
The weights for 512 subbands.

Examples

>>> getStationPhaseCalibration("CS002","LBA_OUTER",)
array([[ 1.14260161 -6.07397622e-18j,  1.14260161 -6.05283530e-18j,
     1.14260161 -6.03169438e-18j, ...,  1.14260161 +4.68675289e-18j,
     1.14260161 +4.70789381e-18j,  1.14260161 +4.72903474e-18j],
   [ 0.95669876 +2.41800591e-18j,  0.95669876 +2.41278190e-18j,
     0.95669876 +2.40755789e-18j, ...,  0.95669876 -2.41017232e-19j,
     0.95669876 -2.46241246e-19j,  0.95669876 -2.51465260e-19j],
   [ 0.98463207 +6.80081617e-03j,  0.98463138 +6.89975906e-03j,
     0.98463069 +6.99870187e-03j, ...,  0.98299670 +5.71319125e-02j,
     0.98299096 +5.72306908e-02j,  0.98298520 +5.73294686e-02j],
   ...,
   [ 1.03201290 +7.39535744e-02j,  1.03144532 +8.14880844e-02j,
     1.03082273 +8.90182487e-02j, ..., -0.82551740 -6.23731331e-01j,
    -0.82094046 -6.29743206e-01j, -0.81631975 -6.35721497e-01j],
   [ 1.12370332 -1.15296909e-01j,  1.12428451 -1.09484545e-01j,
     1.12483564 -1.03669252e-01j, ..., -0.92476286 +6.48703460e-01j,
    -0.92810503 +6.43912711e-01j, -0.93142239 +6.39104744e-01j],
   [ 1.10043006 -6.18995646e-02j,  1.10075250 -5.58731668e-02j,
     1.10104193 -4.98450938e-02j, ..., -1.01051042 +4.40052904e-01j,
    -1.01290481 +4.34513198e-01j, -1.01526883 +4.28960464e-01j]])
>>> getStationPhaseCalibration(122,"LBA_OUTER",)
Calibration data not yet available. Returning 1
array([[ 1.+0.j,  1.+0.j,  1.+0.j, ...,  1.+0.j,  1.+0.j,  1.+0.j],
   [ 1.+0.j,  1.+0.j,  1.+0.j, ...,  1.+0.j,  1.+0.j,  1.+0.j],
   [ 1.+0.j,  1.+0.j,  1.+0.j, ...,  1.+0.j,  1.+0.j,  1.+0.j],
   ...,
   [ 1.+0.j,  1.+0.j,  1.+0.j, ...,  1.+0.j,  1.+0.j,  1.+0.j],
   [ 1.+0.j,  1.+0.j,  1.+0.j, ...,  1.+0.j,  1.+0.j,  1.+0.j],
   [ 1.+0.j,  1.+0.j,  1.+0.j, ...,  1.+0.j,  1.+0.j,  1.+0.j]])
NuRadioReco.modules.io.LOFAR.rawTBBio_metadata.convertPhase_to_Timing(phase_calibration, sample_time=5e-09)[source]

Given the phase calibration of the 512 LOFAR subbands, such as the output of getStationPhaseCalibration, return the timing callibration of each antenna. Not sure how well this works with HBA antennas. Sample time should be seconds per sample. Default is 5 ns

NuRadioReco.modules.io.LOFAR.rawTBBio_metadata.getClockCorrectionFromParsetAddition(metadata_dir)[source]
NuRadioReco.modules.io.LOFAR.rawTBBio_metadata.getClockCorrections(antenna_set='LBA', time=1383263000, metadata_dir=None)[source]

Get clock correction for superterp stations in seconds. Currently static values.

station Station name or number for which to get the correction. time Optional. Linux time of observation. As clocks drift the value from the correct time should be given. Not yet implemented.