Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CHIME static RFI adjustments #67

Merged
merged 6 commits into from
Feb 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ jobs:
steps:
- uses: actions/checkout@v2

- name: Set up Python 3.10
- name: Set up Python 3.11
uses: actions/setup-python@v2
with:
python-version: "3.10"
python-version: "3.11"

- name: Install black
run: pip install black
Expand Down Expand Up @@ -71,10 +71,10 @@ jobs:
sudo apt-get update
sudo apt-get install -y libopenmpi-dev openmpi-bin libhdf5-serial-dev

- name: Set up Python 3.10
- name: Set up Python 3.11
uses: actions/setup-python@v2
with:
python-version: "3.10"
python-version: "3.11"

- name: Install pip dependencies
run: |
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/sphinx.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ jobs:
runs-on: ubuntu-latest
steps:

- name: Set up Python 3.9
- name: Set up Python 3.11
uses: actions/setup-python@v1
with:
python-version: 3.9
python-version: "3.11"

- name: Install apt dependencies
run: |
Expand Down
1 change: 1 addition & 0 deletions ch_util/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
timing
tools
"""

from . import _version

__version__ = _version.get_versions()["version"]
4 changes: 1 addition & 3 deletions ch_util/cal_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -2421,9 +2421,7 @@ def interpolate_gain(freq, gain, weight, flag=None, length_scale=30.0):
# of length 2 for sklearn version 1.1.2, but will have a single dimension
# for earlier versions. The line below ensures consistent behavior.
if err_ypred.ndim > 1:
err_ypred = np.sqrt(
np.sum(err_ypred**2, axis=-1) / err_ypred.shape[-1]
)
err_ypred = np.sqrt(np.sum(err_ypred**2, axis=-1) / err_ypred.shape[-1])

interp_weight[test, ii] = tools.invert_no_zero(err_ypred**2)

Expand Down
20 changes: 12 additions & 8 deletions ch_util/chan_monitor.py
Original file line number Diff line number Diff line change
Expand Up @@ -587,9 +587,11 @@ def get_centre(xdists, tol):
devmins = devs.min(axis=1)
centres = np.array(
[
xmeds[ii] # return median
if devmins[ii] < tol # if reasonable
else cylseps[np.argmin(devs[ii])] # or use closest value
(
xmeds[ii] # return median
if devmins[ii] < tol # if reasonable
else cylseps[np.argmin(devs[ii])]
) # or use closest value
for ii in range(devmins.size)
]
)
Expand Down Expand Up @@ -767,11 +769,13 @@ def get_src_cndts(self):
grd_dict = {"CygA": 4, "CasA": 4, "TauA": 3, "VirA": 1}
# Grades for each source
grds = [
grd_dict[src.name] - 2
if (
(src.name in ["CygA", "CasA"]) and (not ntt[ii])
) # CasA and CygA at daytime worse than TauA at night
else grd_dict[src.name]
(
grd_dict[src.name] - 2
if (
(src.name in ["CygA", "CasA"]) and (not ntt[ii])
) # CasA and CygA at daytime worse than TauA at night
else grd_dict[src.name]
)
for ii, src in enumerate(srcs)
]

Expand Down
12 changes: 9 additions & 3 deletions ch_util/rfi.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,15 @@
[[None, None], [529.10, 536.52]],
[[None, None], [541.60, 548.00]],
### Additional bad bands
# Narrow, high power bands visible in sensitivities and
# some longer baselines. There is some sporadic rfi in between
# the two bands
[[None, None], [460.15, 460.55]],
[[None, None], [464.00, 470.32]],
# 6 MHz band (reported by Simon)
[[None, None], [505.85, 511.71]],
# This is a bright band which has been around since the beginning.
# It usually gets masked, but not always
[[None, None], [517.97, 524.60]],
# Bright band which has been present since early on
[[None, None], [517.97, 525.00]],
ljgray marked this conversation as resolved.
Show resolved Hide resolved
# UHF TV Channel 27 ending CSD 3212 inclusive (2022/08/24)
# This is extended until CSD 3446 (2023/04/13) to account for gain errors
[[None, 1681410777], [548.00, 554.49]],
Expand All @@ -69,6 +73,8 @@
[[1633758888, None], [584.00, 590.00]],
# UHF TV Channel 35
[[1633758888, None], [596.00, 602.00]],
# Low power band visible in long baselines
[[None, None], [602.00, 607.82]],
# from CSD 2243 (2019/12/31 - ) Rogers’ new 600 MHz band
[[1577755022, None], [617.00, 627.00]],
[[None, None], [693.16, 693.55]],
Expand Down
5 changes: 1 addition & 4 deletions ch_util/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -1270,10 +1270,7 @@ def get_default_frequency_map_stream() -> Tuple[np.ndarray]:
stream[:, 3] = np.tile(np.arange(8).repeat(32), 4)

stream_id = (
stream[:, 0] * 2**12
+ stream[:, 1] * 2**12
+ stream[:, 2] * 2**4
+ stream[:, 3]
stream[:, 0] * 2**12 + stream[:, 1] * 2**12 + stream[:, 2] * 2**4 + stream[:, 3]
).astype(np.int64)

return stream, stream_id
Expand Down
4 changes: 3 additions & 1 deletion doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,9 @@

autodoc_mock_imports = ["networkx"]

intersphinx_mapping = {"https://networkx.github.io/documentation/latest/": None}
intersphinx_mapping = {
"networkx": ("https://networkx.github.io/documentation/latest/", None)
}
# TODO: add "chimedb.core": ("http://todo/", None)}

# Add any paths that contain templates here, relative to this directory.
Expand Down
2 changes: 1 addition & 1 deletion doc/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Sphinx >= 4.0, < 5.0
Sphinx
numpydoc
sphinx_rtd_theme
sphinxcontrib-katex
Expand Down
1 change: 0 additions & 1 deletion scripts/singleuse/generate_archive_test_data_2_X.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

"""


from os import path

import numpy as np
Expand Down
1 change: 0 additions & 1 deletion scripts/singleuse/generate_archive_test_data_3_X.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

"""


from os import path

import numpy as np
Expand Down
1 change: 1 addition & 0 deletions scripts/update_psrcat.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""Query the database for pulsar holography sources and compile them into a
FluxCatalog-style JSON file based on the ATNF pulsar catalog.
"""

import os

import numpy as np
Expand Down
1 change: 0 additions & 1 deletion tests/data_paths.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
"""Module contains paths to test data."""


import glob
from os import path

Expand Down
1 change: 0 additions & 1 deletion tests/test_andata_archive2.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
"""Unit tests for analysis data format."""


import unittest

import numpy as np
Expand Down
1 change: 0 additions & 1 deletion tests/test_andata_dist.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

"""


import unittest

import numpy as np
Expand Down
1 change: 0 additions & 1 deletion tests/test_ephemeris.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
"""Unit tests for ephemeris module."""


import os
from datetime import datetime

Expand Down
Loading