Skip to main content

Finding solutions for clock and tec from calibration phases.

Project description

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

Project details


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.tar.gz (208.9 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-py3-none-any.whl (46.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: lofar_clocktec-1.0.tar.gz
  • Upload date:
  • Size: 208.9 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.tar.gz
Algorithm Hash digest
SHA256 49ea45a25490ebc8f6d536895c5ee765fe158f6f14ee23a3417958d93254d6ed
MD5 5a2a37c2a0084f472d17fe4a20f71632
BLAKE2b-256 6261e89b8bf74fc24cda0b4b5d461b70a9422c31951bd7106dac5885692c1e52

See more details on using hashes here.

File details

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

File metadata

  • Download URL: lofar_clocktec-1.0-py3-none-any.whl
  • Upload date:
  • Size: 46.5 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-py3-none-any.whl
Algorithm Hash digest
SHA256 6822b072c0ad555b81727d6a6708c2d228e85cc951d58c0f94ebfb108ceeb417
MD5 c47fe25be4ddb2b96bef1e8d8afe366d
BLAKE2b-256 f384b16546cf388ea0e6d095ad6fe2413e9a0989b09e9ebf7fab47bc45e253c1

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 Pingdom Monitoring Sentry Error logging StatusPage Status page