Skip to main content

clocktec

Name

lofar-clocktec

Description

Takes lofar calibration phases and do clock/tec separation

Installation

Use pip:

pip install lofar-clocktec

You can also directly install from the repository:

pip install git+https://git.astron.nl/RD/clocktec.git

Usage

Here is an example in how to use the code

import numpy as np
from lofar_clocktec.io import CTInput
from lofar_clocktec.fit_clock_tec import fit_clock_tec
from astropy import units as u
from astropy.time import Time

ct_input = CTInput(
    phases=phases[:, :, :] * u.rad,  # shape of (times, freq, stations) in rad
    freqs=freq * u.Hz,  # in Hz
    flags=flags[:, :, :],  # shape of (times, freq, stations)
    stations=stations[:],  # np array with station names
    times=Time(times / 86400, format="mjd", scale="utc"),  # convert MJD seconds to Time
)

result = fit_clock_tec(
    ct_input,
    ref_station=1,  # CS002 usually
    num_params_init=2,
    spatial_fit=True,  # to get improved reliable phase offsets
    lofar2_mode=True,  # if lofar 2 data - searches for smaller delays for RS
)

tec = result.tec  # TECU
delay = result.clock  # ns
offset = result.phase0  # rad (can be multiples of 2pi)

The function parameters are:

ct_input: CTInput - the data to be fitted, see above hoe to define it

weight_mode: str = "kappa" - how to calculate the weights using the phases. default: kappa from the von mises distribution

initialize_mode: str = "robust" - how to initialize the values for the first time slots, default: robust, it is slower but most reliable

init_with_previous: bool = True - use the previous time slot as initial value (except the first one) - makes the code much faster, default: True

num_params_init: int | None = None - how many params to fit? (2 - delay/tec, 3 - delay/tec/phase_offset, 4 - delay/tec/phase_offset/3rd tec). The most reliable phase offset is calculated with spatial_fit (see below), default: None (will be then be selected automatically - not always reliable yet)

final_ph0_fit: int = 0 - in progress, estimation of phase_offset with a different method - not reliable, default: False

remove_steps: bool = False - only for HBA, where the solutions can have jumps due to degeneracies. This fixes them, default: False

spatial_fit: bool = False - does two things: finds reliable phase offsets and fixes overall jumps for the HBA caused by degeneracies, default: False (recommended to set this to true if you need phase offsets)

allow_pi_wraps: bool = False - set True for IS where the Faraday correction is not good and the data can have pi jumps as well, default: False ref_station: int = 0 - the index of the reference station, default: 0

smooth_solutions: bool = False - smooths final solutions (useful for noisy data) - default:False

lofar2_mode: bool = True - searches for < 20ns delays for both CS and RS. Will fail on LOFAR1 data. Default: True.

log_file: By default a log file general_logs.log is written to the current working directory. Pass log_file=None to suppress this.

Authors and acknowledgment

Main authors: Cristina Cordun, Maaijke Mevius. Partially based on code by Michiel Brentjens

License

This project is licensed under the Apache License Version 2.0

Metadata

Release files for lofar-clocktec 1.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for lofar-clocktec 1.0.2
File Size Uploaded
lofar_clocktec-1.0.2.tar.gz 210.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for lofar-clocktec 1.0.2
File Interpreter ABI Platform
lofar_clocktec-1.0.2-py3-none-any.whl Python 3 none any Details

Total release size: 257.6 kB

Release files / lofar_clocktec-1.0.2.tar.gz

Download URL lofar_clocktec-1.0.2.tar.gz
Size 210.4 kB
Tags Source
SHA-256 checksum
How to use checksums
3090975e700c6d69887df897df7ea5e30f01e9144d72b2175b026cad13ec49cc
BLAKE2b-256 checksum
How to use checksums
c80c28e9c391aade854feec7e166bca96a724f8fcf204803334372dceedcccdf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.15

Release files / lofar_clocktec-1.0.2-py3-none-any.whl

Download URL lofar_clocktec-1.0.2-py3-none-any.whl
Size 47.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ba628d2556c1a1f08f3b557d29859ab8cc1e98f98199ff2d369761470475f1ad
BLAKE2b-256 checksum
How to use checksums
70c99bfa32127202969a080ece24d06755a4dcc703302d63e39a8d14c3fe1ed7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.15

Release history Release notifications | RSS feed

This release

1.0.2 This release

2 release files

1.0.1

2 release files

1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page