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

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

lofar_clocktec-1.0.1.tar.gz (209.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

lofar_clocktec-1.0.1-py3-none-any.whl (46.6 kB view details)

Uploaded Python 3

File details

Details for the file lofar_clocktec-1.0.1.tar.gz.

File metadata

  • Download URL: lofar_clocktec-1.0.1.tar.gz
  • Upload date:
  • Size: 209.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for lofar_clocktec-1.0.1.tar.gz
Algorithm Hash digest
SHA256 15d29e0bc753064f270ae4411158fea4e50df3c63b26bb535fa0d8688e187ca3
MD5 786bbd8040f410586670e2f2a7a88cc3
BLAKE2b-256 5fd24491ad55d57d6f00bc0ac1a1a8610200ad7cf58dfe5883581b403044659c

See more details on using hashes here.

File details

Details for the file lofar_clocktec-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: lofar_clocktec-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 46.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for lofar_clocktec-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 3bc3e8e8570d8a79890afdf1404552a00838c4b910efa6247483b858ee05a178
MD5 7601fddd7428e661b506d7ff2b7abb75
BLAKE2b-256 518439094daba5ae962b59ccd9a3c0eceefb8e070d57d4e6a16f9591668f0686

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page