tabsim 0.0.2__tar.gz → 0.0.4__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {tabsim-0.0.2 → tabsim-0.0.4}/PKG-INFO +10 -2
- {tabsim-0.0.2 → tabsim-0.0.4}/README.md +5 -0
- tabsim-0.0.4/docs/conf.py +14 -0
- {tabsim-0.0.2 → tabsim-0.0.4}/pyproject.toml +3 -2
- {tabsim-0.0.2 → tabsim-0.0.4}/tabsim/config.py +86 -40
- {tabsim-0.0.2 → tabsim-0.0.4}/tabsim/dask/observation.py +24 -24
- {tabsim-0.0.2/tabsim/data/config_files → tabsim-0.0.4/tabsim/data/config}/sim_config_base.yaml +6 -1
- tabsim-0.0.4/tabsim/data/rfi/tles/2023-02-21-navstar.json +1 -0
- tabsim-0.0.4/tabsim/data/telescopes/_telescopes.yaml +19 -0
- {tabsim-0.0.2 → tabsim-0.0.4}/tabsim/jax/coordinates.py +255 -1
- {tabsim-0.0.2 → tabsim-0.0.4}/tabsim/scripts/sim_vis.py +3 -1
- {tabsim-0.0.2 → tabsim-0.0.4}/tabsim/sky.py +3 -1
- {tabsim-0.0.2 → tabsim-0.0.4}/tabsim/tle.py +7 -5
- {tabsim-0.0.2 → tabsim-0.0.4}/tabsim/write.py +39 -3
- {tabsim-0.0.2 → tabsim-0.0.4}/tabsim.egg-info/PKG-INFO +10 -2
- {tabsim-0.0.2 → tabsim-0.0.4}/tabsim.egg-info/SOURCES.txt +15 -12
- {tabsim-0.0.2 → tabsim-0.0.4}/tabsim.egg-info/requires.txt +4 -0
- {tabsim-0.0.2 → tabsim-0.0.4}/tabsim.egg-info/top_level.txt +1 -0
- {tabsim-0.0.2 → tabsim-0.0.4}/LICENSE +0 -0
- {tabsim-0.0.2 → tabsim-0.0.4}/setup.cfg +0 -0
- {tabsim-0.0.2 → tabsim-0.0.4}/tabsim/__init__.py +0 -0
- {tabsim-0.0.2 → tabsim-0.0.4}/tabsim/dask/__init__.py +0 -0
- {tabsim-0.0.2 → tabsim-0.0.4}/tabsim/dask/coordinates.py +0 -0
- {tabsim-0.0.2 → tabsim-0.0.4}/tabsim/dask/extras.py +0 -0
- {tabsim-0.0.2 → tabsim-0.0.4}/tabsim/dask/interferometry.py +0 -0
- {tabsim-0.0.2 → tabsim-0.0.4}/tabsim/data/__init__.py +0 -0
- {tabsim-0.0.2/tabsim/data/config_files → tabsim-0.0.4/tabsim/data/config}/tab_config_base.yaml +0 -0
- {tabsim-0.0.2/tabsim/data/aux_data → tabsim-0.0.4/tabsim/data/rfi}/norad_satellite.rfimodel +0 -0
- {tabsim-0.0.2/tabsim/data/aux_data → tabsim-0.0.4/tabsim/data/rfi}/satellite.ole +0 -0
- {tabsim-0.0.2/tabsim/data/aux_data → tabsim-0.0.4/tabsim/data/rfi}/satellite.rfimodel +0 -0
- {tabsim-0.0.2/tabsim/data/aux_data → tabsim-0.0.4/tabsim/data/rfi}/stationary.loc +0 -0
- {tabsim-0.0.2/tabsim/data/aux_data → tabsim-0.0.4/tabsim/data/rfi}/stationary.rfimodel +0 -0
- {tabsim-0.0.2/tabsim/data/aux_data → tabsim-0.0.4/tabsim/data/rfi}/tles/2023-02-21-J8HE0T.json +0 -0
- {tabsim-0.0.2/tabsim/data/aux_data → tabsim-0.0.4/tabsim/data/sky}/calibrator.skymodel +0 -0
- {tabsim-0.0.2/tabsim/data → tabsim-0.0.4/tabsim/data/telescopes}/EDA2.itrf.txt +0 -0
- {tabsim-0.0.2/tabsim/data → tabsim-0.0.4/tabsim/data/telescopes}/MWA.itrf.txt +0 -0
- {tabsim-0.0.2/tabsim/data → tabsim-0.0.4/tabsim/data/telescopes}/MeerKAT.itrf.txt +0 -0
- {tabsim-0.0.2 → tabsim-0.0.4}/tabsim/jax/__init__.py +0 -0
- {tabsim-0.0.2 → tabsim-0.0.4}/tabsim/jax/interferometry.py +0 -0
- {tabsim-0.0.2 → tabsim-0.0.4}/tabsim/jax/utils.py +0 -0
- {tabsim-0.0.2 → tabsim-0.0.4}/tabsim/plot.py +0 -0
- {tabsim-0.0.2 → tabsim-0.0.4}/tabsim/scripts/__init__.py +0 -0
- {tabsim-0.0.2 → tabsim-0.0.4}/tabsim/scripts/ast_region.py +0 -0
- {tabsim-0.0.2 → tabsim-0.0.4}/tabsim/scripts/flag_data.py +0 -0
- {tabsim-0.0.2 → tabsim-0.0.4}/tabsim/scripts/tle_sat_region.py +0 -0
- {tabsim-0.0.2 → tabsim-0.0.4}/tabsim/tools.py +0 -0
- {tabsim-0.0.2 → tabsim-0.0.4}/tabsim.egg-info/dependency_links.txt +0 -0
- {tabsim-0.0.2 → tabsim-0.0.4}/tabsim.egg-info/entry_points.txt +0 -0
- {tabsim-0.0.2 → tabsim-0.0.4}/tests/test_basic.py +0 -0
- {tabsim-0.0.2 → tabsim-0.0.4}/tests/test_sim-vis.py +0 -0
- {tabsim-0.0.2 → tabsim-0.0.4}/tests/test_version.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: tabsim
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.4
|
|
4
4
|
Summary: Trajectory-based Radio Frequency Interference (RFI) simulations for radio interferometeric data.
|
|
5
5
|
Author-email: Chris Finlay <christopher.finlay@epfl.ch>
|
|
6
6
|
Maintainer-email: Chris Finlay <christopher.finlay@epfl.ch>
|
|
@@ -680,7 +680,7 @@ License: GNU GENERAL PUBLIC LICENSE
|
|
|
680
680
|
<https://www.gnu.org/licenses/why-not-lgpl.html>.
|
|
681
681
|
|
|
682
682
|
Project-URL: Repository, https://github.com/chrisfinlay/tab-sim.git
|
|
683
|
-
Requires-Python: <3.13,>=3.
|
|
683
|
+
Requires-Python: <3.13,>=3.9
|
|
684
684
|
Description-Content-Type: text/markdown
|
|
685
685
|
License-File: LICENSE
|
|
686
686
|
Requires-Dist: jax
|
|
@@ -704,12 +704,16 @@ Requires-Dist: ipython; extra == "ipy"
|
|
|
704
704
|
Requires-Dist: ipykernel; extra == "ipy"
|
|
705
705
|
Provides-Extra: test
|
|
706
706
|
Requires-Dist: pytest; extra == "test"
|
|
707
|
+
Provides-Extra: docs
|
|
708
|
+
Requires-Dist: sphinx; extra == "docs"
|
|
709
|
+
Requires-Dist: sphinx-rtd-theme; extra == "docs"
|
|
707
710
|
Dynamic: license-file
|
|
708
711
|
|
|
709
712
|
# tab-sim
|
|
710
713
|
|
|
711
714
|
[](https://doi.org/10.1093/mnras/stad1979)
|
|
712
715
|
[](https://doi.org/10.48550/arXiv.2502.00106)
|
|
716
|
+
[](https://tab-sim.readthedocs.io/en/latest/?badge=latest)
|
|
713
717
|
|
|
714
718
|
**T**r**A**jectory **B**ased RFI **Sim**ulations of radio interferometry data.
|
|
715
719
|
A source to visibility model for RFI sources including certain near-field effects.
|
|
@@ -717,6 +721,10 @@ A source to visibility model for RFI sources including certain near-field effect
|
|
|
717
721
|
`tab-sim` is written in [JAX](https://jax.readthedocs.io/en/latest/notebooks/quickstart.html)
|
|
718
722
|
and [Dask](https://www.dask.org) and can therefore use GPUs and/or CPUs to perform larger than memory computation.
|
|
719
723
|
|
|
724
|
+
## Documentation
|
|
725
|
+
|
|
726
|
+
[https://tab-sim.readthedocs.io/](https://tab-sim.readthedocs.io/)
|
|
727
|
+
|
|
720
728
|
## Installation
|
|
721
729
|
|
|
722
730
|
The following instructions are expected to work on Linux machine. If you are running Windows it is recommended to use WSL. If you are running Mac then it is best to start with a [conda](https://docs.conda.io/en/latest/)/[mamba](https://mamba.readthedocs.io/en/latest/index.html) environment and install `python-casacore` before continuing with the `pip` install method. If all else fails there is the [Docker install](#docker).
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
[](https://doi.org/10.1093/mnras/stad1979)
|
|
4
4
|
[](https://doi.org/10.48550/arXiv.2502.00106)
|
|
5
|
+
[](https://tab-sim.readthedocs.io/en/latest/?badge=latest)
|
|
5
6
|
|
|
6
7
|
**T**r**A**jectory **B**ased RFI **Sim**ulations of radio interferometry data.
|
|
7
8
|
A source to visibility model for RFI sources including certain near-field effects.
|
|
@@ -9,6 +10,10 @@ A source to visibility model for RFI sources including certain near-field effect
|
|
|
9
10
|
`tab-sim` is written in [JAX](https://jax.readthedocs.io/en/latest/notebooks/quickstart.html)
|
|
10
11
|
and [Dask](https://www.dask.org) and can therefore use GPUs and/or CPUs to perform larger than memory computation.
|
|
11
12
|
|
|
13
|
+
## Documentation
|
|
14
|
+
|
|
15
|
+
[https://tab-sim.readthedocs.io/](https://tab-sim.readthedocs.io/)
|
|
16
|
+
|
|
12
17
|
## Installation
|
|
13
18
|
|
|
14
19
|
The following instructions are expected to work on Linux machine. If you are running Windows it is recommended to use WSL. If you are running Mac then it is best to start with a [conda](https://docs.conda.io/en/latest/)/[mamba](https://mamba.readthedocs.io/en/latest/index.html) environment and install `python-casacore` before continuing with the `pip` install method. If all else fails there is the [Docker install](#docker).
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import os
|
|
2
|
+
import sys
|
|
3
|
+
sys.path.insert(0, os.path.abspath('..'))
|
|
4
|
+
|
|
5
|
+
project = 'tab‑sim'
|
|
6
|
+
author = 'Chris Finlay'
|
|
7
|
+
extensions = [
|
|
8
|
+
'sphinx.ext.autodoc',
|
|
9
|
+
'sphinx.ext.napoleon',
|
|
10
|
+
'sphinx.ext.viewcode',
|
|
11
|
+
]
|
|
12
|
+
templates_path = ['_templates']
|
|
13
|
+
exclude_patterns = []
|
|
14
|
+
html_theme = 'sphinx_rtd_theme'
|
|
@@ -5,7 +5,7 @@ build-backend = "setuptools.build_meta"
|
|
|
5
5
|
|
|
6
6
|
[project]
|
|
7
7
|
name = "tabsim"
|
|
8
|
-
version = "0.0.
|
|
8
|
+
version = "0.0.4"
|
|
9
9
|
license = {file = "LICENSE"}
|
|
10
10
|
readme = "README.md"
|
|
11
11
|
# dynamic = ["version", "readme"]
|
|
@@ -17,7 +17,7 @@ maintainers = [
|
|
|
17
17
|
]
|
|
18
18
|
description = "Trajectory-based Radio Frequency Interference (RFI) simulations for radio interferometeric data."
|
|
19
19
|
|
|
20
|
-
requires-python = ">=3.
|
|
20
|
+
requires-python = ">=3.9,<3.13"
|
|
21
21
|
dependencies = [
|
|
22
22
|
"jax", "dask<=2024.10.0", "xarray", "zarr<3.0.0",
|
|
23
23
|
"dask-ms>=0.2.21", "scipy", "tqdm", "matplotlib",
|
|
@@ -32,6 +32,7 @@ sat = ["regions"]
|
|
|
32
32
|
# all_cpu = ["regions", "bdsf", "TGEpy @ git+https://github.com/chrisfinlay/TGEpy.git"]
|
|
33
33
|
ipy = ["ipython", "ipykernel"]
|
|
34
34
|
test = ["pytest"]
|
|
35
|
+
docs = ["sphinx", "sphinx-rtd-theme"]
|
|
35
36
|
|
|
36
37
|
[project.urls]
|
|
37
38
|
Repository = "https://github.com/chrisfinlay/tab-sim.git"
|
|
@@ -5,7 +5,8 @@ import sys
|
|
|
5
5
|
import shutil
|
|
6
6
|
|
|
7
7
|
import collections.abc
|
|
8
|
-
from typing import Tuple
|
|
8
|
+
from typing import Tuple, Union, Optional
|
|
9
|
+
|
|
9
10
|
from datetime import datetime
|
|
10
11
|
|
|
11
12
|
import dask.array as da
|
|
@@ -13,27 +14,23 @@ from dask.array.core import Array
|
|
|
13
14
|
import xarray as xr
|
|
14
15
|
import numpy as np
|
|
15
16
|
import pandas as pd
|
|
17
|
+
from astropy.time import Time
|
|
16
18
|
|
|
17
19
|
from tabsim.dask.observation import Observation
|
|
18
20
|
from tabsim.sky import generate_random_sky
|
|
19
21
|
from tabsim.plot import plot_uv, plot_src_alt, plot_angular_seps
|
|
20
22
|
from tabsim.write import write_ms, mk_obs_name, mk_obs_dir
|
|
21
|
-
from tabsim.jax.coordinates import calculate_fringe_frequency
|
|
22
|
-
from tabsim.tle import get_visible_satellite_tles
|
|
23
|
+
from tabsim.jax.coordinates import calculate_fringe_frequency, jd_to_mjd
|
|
24
|
+
from tabsim.tle import get_visible_satellite_tles, id_generator
|
|
23
25
|
|
|
24
26
|
from daskms import xds_from_ms
|
|
25
27
|
|
|
26
28
|
from tqdm import tqdm
|
|
27
29
|
from importlib.resources import files
|
|
28
30
|
|
|
29
|
-
config_dir = files("tabsim.data").joinpath("config_files").__str__()
|
|
30
31
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
# extract_base_config_path = os.path.join(config_dir, "extract_config_base.yaml")
|
|
34
|
-
# pow_spec_base_config_path = os.path.join(
|
|
35
|
-
# config_dir, "extract_pow_spec_config_base.yaml"
|
|
36
|
-
# )
|
|
32
|
+
sky_dir = files("tabsim.data").joinpath("sky").__str__()
|
|
33
|
+
|
|
37
34
|
|
|
38
35
|
JD0 = 2459997.079914223 # 2023-02-21 13:55:04.589 UTC => GMSA = 0
|
|
39
36
|
MJD0 = JD0 - 2400000.5
|
|
@@ -113,24 +110,67 @@ def load_config(path: str, config_type: str = "sim") -> dict:
|
|
|
113
110
|
dict
|
|
114
111
|
Configuration dictionary.
|
|
115
112
|
"""
|
|
113
|
+
config_dir = files("tabsim.data").joinpath("config").__str__()
|
|
114
|
+
|
|
115
|
+
sim_base_config_path = os.path.join(config_dir, "sim_config_base.yaml")
|
|
116
|
+
tab_base_config_path = os.path.join(config_dir, "tab_config_base.yaml")
|
|
117
|
+
# extract_base_config_path = os.path.join(config_dir, "extract_config_base.yaml")
|
|
118
|
+
# pow_spec_base_config_path = os.path.join(
|
|
119
|
+
# config_dir, "extract_pow_spec_config_base.yaml"
|
|
120
|
+
# )
|
|
116
121
|
|
|
117
122
|
config = yaml_load(path)
|
|
118
123
|
if config_type == "sim":
|
|
119
124
|
base_config = yaml_load(sim_base_config_path)
|
|
120
125
|
elif config_type == "tab":
|
|
121
126
|
base_config = yaml_load(tab_base_config_path)
|
|
122
|
-
elif config_type == "extract":
|
|
123
|
-
|
|
124
|
-
elif config_type == "pow_spec":
|
|
125
|
-
|
|
127
|
+
# elif config_type == "extract":
|
|
128
|
+
# base_config = yaml_load(extract_base_config_path)
|
|
129
|
+
# elif config_type == "pow_spec":
|
|
130
|
+
# base_config = yaml_load(pow_spec_base_config_path)
|
|
126
131
|
else:
|
|
127
|
-
ValueError(
|
|
128
|
-
"A config type must be specified. Options are {sim, tab, extract, pow_spec}."
|
|
129
|
-
)
|
|
132
|
+
raise ValueError("A config type must be specified. Options are {sim, tab}.")
|
|
130
133
|
|
|
131
134
|
return deep_update(base_config, config)
|
|
132
135
|
|
|
133
136
|
|
|
137
|
+
def get_telescope_definitions(tel_name: str):
|
|
138
|
+
|
|
139
|
+
tel_dir = files("tabsim.data").joinpath("telescopes").__str__()
|
|
140
|
+
tel_def = yaml_load(os.path.join(tel_dir, "_telescopes.yaml"))
|
|
141
|
+
|
|
142
|
+
tel_name = tel_name.lower()
|
|
143
|
+
telescope_list = tel_def.keys()
|
|
144
|
+
|
|
145
|
+
if tel_name in telescope_list:
|
|
146
|
+
tel_def = tel_def[tel_name]
|
|
147
|
+
tel_def["itrf_path"] = os.path.join(tel_dir, tel_def["itrf_path"])
|
|
148
|
+
else:
|
|
149
|
+
raise ValueError(
|
|
150
|
+
f"{tel_name} is not a pre-defined telescope within tab-sim. Choose from {telescope_list}"
|
|
151
|
+
)
|
|
152
|
+
|
|
153
|
+
return tel_def
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
def get_rfi_definitions():
|
|
157
|
+
|
|
158
|
+
rfi_dir = files("tabsim.data").joinpath("rfi").__str__()
|
|
159
|
+
|
|
160
|
+
rfi_def = {
|
|
161
|
+
"tle_satellite": {
|
|
162
|
+
"tle_dir": os.path.join(rfi_dir, "tles"),
|
|
163
|
+
"norad_spec_model": os.path.join(rfi_dir, "norad_satellite.rfimodel"),
|
|
164
|
+
},
|
|
165
|
+
"stationary": {
|
|
166
|
+
"geo_path": os.path.join(rfi_dir, "stationary.loc"),
|
|
167
|
+
"spec_path": os.path.join(rfi_dir, "stationary.rfimodel"),
|
|
168
|
+
},
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
return rfi_def
|
|
172
|
+
|
|
173
|
+
|
|
134
174
|
def load_sky_model(file_path: str, freqs: Array, src_type: str) -> tuple:
|
|
135
175
|
"""Read in a skymodel file and return parameters to be used in tabascal simulator.
|
|
136
176
|
A skymodel file is a csv file with the following columns:
|
|
@@ -188,7 +228,7 @@ def load_sky_model(file_path: str, freqs: Array, src_type: str) -> tuple:
|
|
|
188
228
|
raise KeyError("'src_type' must be one of {'point', 'gauss', 'exp'}.")
|
|
189
229
|
|
|
190
230
|
|
|
191
|
-
def sigma_value(value: str
|
|
231
|
+
def sigma_value(value: Union[str, float, int], obs: Observation):
|
|
192
232
|
try:
|
|
193
233
|
if isinstance(value, str):
|
|
194
234
|
sigma = (np.mean(obs.noise_std) / np.sqrt(obs.n_time * obs.n_bl)).compute()
|
|
@@ -212,12 +252,9 @@ def load_obs(obs_spec: dict) -> Observation:
|
|
|
212
252
|
return x
|
|
213
253
|
|
|
214
254
|
if obs_["start_time_jd"]:
|
|
215
|
-
from tabascal.jax.coordinates import jd_to_mjd
|
|
216
255
|
|
|
217
256
|
start_time_mjd = jd_to_mjd(obs_["start_time_jd"])
|
|
218
257
|
elif obs_["start_time_isot"]:
|
|
219
|
-
from astropy.time import Time
|
|
220
|
-
from tabascal.jax.coordinates import jd_to_mjd
|
|
221
258
|
|
|
222
259
|
start_time_mjd = jd_to_mjd(
|
|
223
260
|
Time(obs_["start_time_isot"], format="isot", scale="ut1").jd
|
|
@@ -730,20 +767,7 @@ def save_inputs(obs: Observation, obs_spec: dict, save_path: str) -> None:
|
|
|
730
767
|
if path is not None:
|
|
731
768
|
shutil.copy(path, save_path)
|
|
732
769
|
|
|
733
|
-
key =
|
|
734
|
-
2
|
|
735
|
-
* [
|
|
736
|
-
"tle_satellite",
|
|
737
|
-
]
|
|
738
|
-
+ 2
|
|
739
|
-
* [
|
|
740
|
-
"satellite",
|
|
741
|
-
]
|
|
742
|
-
+ 2
|
|
743
|
-
* [
|
|
744
|
-
"stationary",
|
|
745
|
-
]
|
|
746
|
-
)
|
|
770
|
+
key = 2 * ["tle_satellite"] + 2 * ["satellite"] + 2 * ["stationary"]
|
|
747
771
|
subkey = [
|
|
748
772
|
"norad_ids_path",
|
|
749
773
|
"norad_spec_model",
|
|
@@ -836,8 +860,24 @@ def print_fringe_freq_tle_sat(obs: Observation):
|
|
|
836
860
|
print(f"Recommended n_int is >= : {n_int:.0f} ({obs.n_int_samples} used)")
|
|
837
861
|
|
|
838
862
|
|
|
863
|
+
def check_telescope_defintion(tel_def: dict):
|
|
864
|
+
|
|
865
|
+
dish_d = tel_def["dish_d"]
|
|
866
|
+
|
|
867
|
+
if tel_def["itrf_path"] and dish_d:
|
|
868
|
+
return True
|
|
869
|
+
elif (
|
|
870
|
+
tel_def["longitude"] and tel_def["latitude"] and tel_def["enu_path"] and dish_d
|
|
871
|
+
):
|
|
872
|
+
return True
|
|
873
|
+
else:
|
|
874
|
+
return False
|
|
875
|
+
|
|
876
|
+
|
|
839
877
|
def run_sim_config(
|
|
840
|
-
obs_spec: dict = None,
|
|
878
|
+
obs_spec: Optional[dict] = None,
|
|
879
|
+
config_path: Optional[str] = None,
|
|
880
|
+
spacetrack_path: Optional[str] = None,
|
|
841
881
|
) -> Tuple[Observation, str]:
|
|
842
882
|
|
|
843
883
|
from tabsim.tle import id_generator
|
|
@@ -850,16 +890,22 @@ def run_sim_config(
|
|
|
850
890
|
start = datetime.now()
|
|
851
891
|
print(datetime.now())
|
|
852
892
|
|
|
853
|
-
if config_path
|
|
893
|
+
if config_path:
|
|
854
894
|
obs_spec = load_config(config_path, config_type="sim")
|
|
855
895
|
elif obs_spec is None:
|
|
856
|
-
|
|
857
|
-
|
|
896
|
+
raise ValueError("obs_spec or config_path must be defined.")
|
|
897
|
+
|
|
898
|
+
rfi_def = get_rfi_definitions()
|
|
899
|
+
obs_spec["rfi_sources"] = deep_update(obs_spec["rfi_sources"], rfi_def)
|
|
900
|
+
|
|
901
|
+
if not check_telescope_defintion(obs_spec["telescope"]):
|
|
902
|
+
tel_def = get_telescope_definitions(obs_spec["telescope"]["name"])
|
|
903
|
+
obs_spec["telescope"] = deep_update(obs_spec["telescope"], tel_def)
|
|
858
904
|
|
|
859
905
|
obs = load_obs(obs_spec)
|
|
860
906
|
add_astro_sources(obs, obs_spec)
|
|
861
907
|
add_satellite_sources(obs, obs_spec)
|
|
862
|
-
if obs_spec["rfi_sources"]["tle_satellite"]["max_n_sat"] != 0:
|
|
908
|
+
if obs_spec["rfi_sources"]["tle_satellite"]["max_n_sat"] != 0 and spacetrack_path:
|
|
863
909
|
add_tle_satellite_sources(obs, obs_spec, spacetrack_path)
|
|
864
910
|
add_stationary_sources(obs, obs_spec)
|
|
865
911
|
add_gains(obs, obs_spec)
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import jax.numpy as jnp
|
|
2
1
|
from jax import config, Array
|
|
3
2
|
|
|
4
3
|
import dask.array as da
|
|
5
4
|
import numpy as np
|
|
6
5
|
import xarray as xr
|
|
6
|
+
from typing import Optional
|
|
7
7
|
|
|
8
8
|
from tabsim.dask.coordinates import (
|
|
9
9
|
ENU_to_ITRF,
|
|
@@ -75,12 +75,12 @@ class Telescope(object):
|
|
|
75
75
|
latitude: float,
|
|
76
76
|
longitude: float,
|
|
77
77
|
elevation: float = 0.0,
|
|
78
|
-
ENU_array: Array = None,
|
|
79
|
-
ENU_path: str = None,
|
|
80
|
-
ITRF_array: Array = None,
|
|
81
|
-
ITRF_path: str = None,
|
|
82
|
-
tel_name: str = None,
|
|
83
|
-
n_ant: int = None,
|
|
78
|
+
ENU_array: Optional[Array] = None,
|
|
79
|
+
ENU_path: Optional[str] = None,
|
|
80
|
+
ITRF_array: Optional[Array] = None,
|
|
81
|
+
ITRF_path: Optional[str] = None,
|
|
82
|
+
tel_name: Optional[str] = None,
|
|
83
|
+
n_ant: Optional[int] = None,
|
|
84
84
|
):
|
|
85
85
|
self.tel_name = tel_name
|
|
86
86
|
self.latitude = da.asarray(latitude)
|
|
@@ -132,16 +132,16 @@ Elevation : {elevation}\n"""
|
|
|
132
132
|
self.ITRF = ENU_to_ITRF(self.ENU, self.latitude, self.longitude, self.elevation)
|
|
133
133
|
|
|
134
134
|
def createArrayITRF(self, ITRF_array, ITRF_path):
|
|
135
|
+
|
|
135
136
|
if ITRF_array is not None:
|
|
136
137
|
self.ITRF = ITRF_array
|
|
137
138
|
elif ITRF_path is not None:
|
|
138
139
|
self.ITRF = np.loadtxt(ITRF_path, usecols=(0, 1, 2), max_rows=self.n_ant)
|
|
139
140
|
else:
|
|
140
|
-
|
|
141
|
-
msg = """Error : ITRF antenna coordinates are needed either in an
|
|
141
|
+
msg = """ITRF antenna coordinates are needed either in an
|
|
142
142
|
array or as a csv like file."""
|
|
143
|
-
|
|
144
|
-
|
|
143
|
+
raise ValueError(msg)
|
|
144
|
+
|
|
145
145
|
self.ITRF = da.asarray(self.ITRF)
|
|
146
146
|
self.GEO_ants = da.asarray(itrf_to_geo(self.ITRF.compute()))
|
|
147
147
|
|
|
@@ -205,11 +205,11 @@ class Observation(Telescope):
|
|
|
205
205
|
times_mjd: Array,
|
|
206
206
|
int_time: float = 2.0,
|
|
207
207
|
chan_width: float = 209e3,
|
|
208
|
-
ENU_array: Array = None,
|
|
209
|
-
ENU_path: str = None,
|
|
210
|
-
ITRF_array: Array = None,
|
|
211
|
-
ITRF_path: str = None,
|
|
212
|
-
n_ant: int = None,
|
|
208
|
+
ENU_array: Optional[Array] = None,
|
|
209
|
+
ENU_path: Optional[str] = None,
|
|
210
|
+
ITRF_array: Optional[Array] = None,
|
|
211
|
+
ITRF_path: Optional[str] = None,
|
|
212
|
+
n_ant: Optional[int] = None,
|
|
213
213
|
dish_d: float = 13.5,
|
|
214
214
|
random_seed: int = 0,
|
|
215
215
|
auto_corrs: bool = False,
|
|
@@ -242,7 +242,7 @@ class Observation(Telescope):
|
|
|
242
242
|
self.target_name = target_name
|
|
243
243
|
self.auto_corrs = auto_corrs
|
|
244
244
|
|
|
245
|
-
a1, a2 =
|
|
245
|
+
a1, a2 = np.triu_indices(self.n_ant, 0 if auto_corrs else 1)
|
|
246
246
|
self.n_bl = len(a1)
|
|
247
247
|
|
|
248
248
|
self.ant_chunk = self.n_ant
|
|
@@ -326,17 +326,17 @@ class Observation(Telescope):
|
|
|
326
326
|
self.vis_rfi = da.zeros(
|
|
327
327
|
shape=(self.n_time, self.n_bl, self.n_freq),
|
|
328
328
|
chunks=(self.time_chunk, self.bl_chunk, self.freq_chunk),
|
|
329
|
-
dtype=
|
|
329
|
+
dtype=np.complex128,
|
|
330
330
|
)
|
|
331
331
|
self.vis_ast = da.zeros(
|
|
332
332
|
shape=(self.n_time, self.n_bl, self.n_freq),
|
|
333
333
|
chunks=(self.time_chunk, self.bl_chunk, self.freq_chunk),
|
|
334
|
-
dtype=
|
|
334
|
+
dtype=np.complex128,
|
|
335
335
|
)
|
|
336
336
|
self.gains_ants = da.ones(
|
|
337
337
|
shape=(self.n_time, self.n_ant, self.n_freq),
|
|
338
338
|
chunks=(self.time_chunk, self.ant_chunk, self.freq_chunk),
|
|
339
|
-
dtype=
|
|
339
|
+
dtype=np.complex128,
|
|
340
340
|
)
|
|
341
341
|
self.random_seed = random_seed
|
|
342
342
|
|
|
@@ -486,7 +486,7 @@ Number of stationary RFI : {n_stat}"""
|
|
|
486
486
|
|
|
487
487
|
self.ast_p_I.append(I)
|
|
488
488
|
self.ast_p_lmn.append(lmn)
|
|
489
|
-
self.ast_p_radec.append(
|
|
489
|
+
self.ast_p_radec.append(np.array([ra, dec]))
|
|
490
490
|
self.n_p_ast += len(I)
|
|
491
491
|
self.n_ast += len(I)
|
|
492
492
|
|
|
@@ -550,7 +550,7 @@ Number of stationary RFI : {n_stat}"""
|
|
|
550
550
|
self.ast_g_pos_angle.append(pos_angle)
|
|
551
551
|
self.ast_g_I.append(I)
|
|
552
552
|
self.ast_g_lmn.append(lmn)
|
|
553
|
-
self.ast_g_radec.append(
|
|
553
|
+
self.ast_g_radec.append(np.array([ra, dec]))
|
|
554
554
|
self.n_g_ast += len(I)
|
|
555
555
|
self.n_ast += len(I)
|
|
556
556
|
|
|
@@ -596,7 +596,7 @@ Number of stationary RFI : {n_stat}"""
|
|
|
596
596
|
self.ast_e_major.append(shape)
|
|
597
597
|
self.ast_e_I.append(I)
|
|
598
598
|
self.ast_e_lmn.append(lmn)
|
|
599
|
-
self.ast_e_radec.append(
|
|
599
|
+
self.ast_e_radec.append(np.array([ra, dec]))
|
|
600
600
|
self.n_e_ast += len(I)
|
|
601
601
|
self.n_ast += len(I)
|
|
602
602
|
|
|
@@ -959,7 +959,7 @@ Number of stationary RFI : {n_stat}"""
|
|
|
959
959
|
self,
|
|
960
960
|
path: str = "Observation.ms",
|
|
961
961
|
overwrite: bool = False,
|
|
962
|
-
ds: xr.Dataset = None,
|
|
962
|
+
ds: Optional[xr.Dataset] = None,
|
|
963
963
|
):
|
|
964
964
|
"""
|
|
965
965
|
Write the visibilities to disk using Measurement Set format.
|
{tabsim-0.0.2/tabsim/data/config_files → tabsim-0.0.4/tabsim/data/config}/sim_config_base.yaml
RENAMED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
# This is base simulation config that is loaded and then updated with your provided config.
|
|
3
3
|
# Populated parameters here are the default values used if none are specified in your config.
|
|
4
4
|
###############################################################################################
|
|
5
|
+
# Astronomical Sources
|
|
6
|
+
#######################
|
|
5
7
|
ast_sources:
|
|
6
8
|
##########################################
|
|
7
9
|
# Exponential shaped astronomical sources
|
|
@@ -125,6 +127,9 @@ output:
|
|
|
125
127
|
path: ./ # Optional - Path to where the simulation should be saved
|
|
126
128
|
prefix: null # Optional - Prefix used in the simulation file name
|
|
127
129
|
suffix: null # Optional - Suffix used in the simulation file name
|
|
130
|
+
##############
|
|
131
|
+
# RFI sources
|
|
132
|
+
##############
|
|
128
133
|
rfi_sources:
|
|
129
134
|
#######################################
|
|
130
135
|
# Circular trajectory based satellites
|
|
@@ -164,7 +169,7 @@ rfi_sources:
|
|
|
164
169
|
telescope:
|
|
165
170
|
latitude: null # Required - Latitude of the telescope location in decimal degrees. North is +ve
|
|
166
171
|
longitude: null # Required - Longitude of the telescope in decimal degrees. East from Greenwich meridian
|
|
167
|
-
elevation:
|
|
172
|
+
elevation: 0 # Required - Elevation of the telescope above the WGS84 Earth ellipsoid model in metres.
|
|
168
173
|
dish_d: null # Required - Dish diameter in metres
|
|
169
174
|
enu_path: null # Required if itrf_path is null - Path to the csv file of the antennas in East, North, Up frame, in metres, relative to the telescope location
|
|
170
175
|
itrf_path: null # Required if enu_path is null - Path to the csv file contaning the antenna positions in International Terrestrial Reference Frame in metres.
|