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

Update sphinx and black #261

Merged
merged 4 commits into from
Feb 13, 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
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
2 changes: 1 addition & 1 deletion doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
#
# This is also used if you do content translation via gettext catalogs.
# Usually you set "language" from the command line for these cases.
language = None
language = "en"

# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
Expand Down
2 changes: 1 addition & 1 deletion doc/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
Sphinx >= 4.0, < 5.0
Sphinx
sphinx_rtd_theme
12 changes: 6 additions & 6 deletions draco/analysis/beamform.py
Original file line number Diff line number Diff line change
Expand Up @@ -326,18 +326,18 @@ def process(self):
# beamform()
this_sumweight = np.sum(sumweight_inrange, axis=-1)
# Populate only where ha_mask is true. Zero otherwise.
formed_beam_full[pol][
:, ha_mask
] = this_formed_beam * invert_no_zero(this_sumweight)
formed_beam_full[pol][:, ha_mask] = (
this_formed_beam * invert_no_zero(this_sumweight)
)
if self.weight != "inverse_variance":
this_weight2 = np.sum(
sumweight_inrange**2 * invert_no_zero(visweight_inrange),
axis=-1,
)
# Populate only where ha_mask is true. Zero otherwise.
weight_full[pol][
:, ha_mask
] = this_sumweight**2 * invert_no_zero(this_weight2)
weight_full[pol][:, ha_mask] = (
this_sumweight**2 * invert_no_zero(this_weight2)
)
else:
weight_full[pol][:, ha_mask] = this_sumweight

Expand Down
1 change: 0 additions & 1 deletion draco/analysis/fgfilter.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
"""Tasks for foreground filtering data."""


import numpy as np
from caput import config

Expand Down
14 changes: 6 additions & 8 deletions draco/analysis/flagging.py
Original file line number Diff line number Diff line change
Expand Up @@ -1275,12 +1275,12 @@ class RFIMask(task.SingleTask):
stack_ind = config.Property(proptype=int)

@overload
def process(self, sstream: containers.SiderealStream) -> containers.SiderealRFIMask:
...
def process(
self, sstream: containers.SiderealStream
) -> containers.SiderealRFIMask: ...

@overload
def process(self, sstream: containers.TimeStream) -> containers.RFIMask:
...
def process(self, sstream: containers.TimeStream) -> containers.RFIMask: ...

def process(
self, sstream: Union[containers.TimeStream, containers.SiderealStream]
Expand Down Expand Up @@ -1479,14 +1479,12 @@ class ApplyBaselineMask(task.SingleTask):
@overload
def process(
self, data: containers.TimeStream, mask: containers.BaselineMask
) -> containers.TimeStream:
...
) -> containers.TimeStream: ...

@overload
def process(
self, data: containers.SiderealStream, mask: containers.SiderealBaselineMask
) -> containers.SiderealStream:
...
) -> containers.SiderealStream: ...

def process(self, data, mask):
"""Flag data by zeroing the weights.
Expand Down
1 change: 0 additions & 1 deletion draco/analysis/powerspectrum.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
"""Power spectrum estimation code."""


import numpy as np
from caput import config

Expand Down
1 change: 1 addition & 0 deletions draco/analysis/ringmapmaker.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
WienerRingMapMakerExternal
RADependentWeights
"""

import numpy as np
import scipy.constants
from caput import config
Expand Down
5 changes: 1 addition & 4 deletions draco/analysis/sidereal.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
:class:`SiderealStacker` if you want to combine the different days.
"""


import numpy as np
import scipy.linalg as la
from caput import config, mpiarray, tod
Expand Down Expand Up @@ -629,9 +628,7 @@ def process_finish(self):
# number of samples squared and then invert to finalize stack.weight.
if self.weight == "uniform":
norm = self.stack.nsample[:].astype(np.float32)
self.stack.weight[:] = (
tools.invert_no_zero(self.stack.weight[:]) * norm**2
)
self.stack.weight[:] = tools.invert_no_zero(self.stack.weight[:]) * norm**2

# We need to normalize the sample variance by the sum of coefficients.
# Can be found in the stack.nsample dataset for uniform case
Expand Down
15 changes: 8 additions & 7 deletions draco/analysis/transform.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

This includes grouping frequencies and products to performing the m-mode transform.
"""

from typing import Optional, Tuple, Union, overload

import numpy as np
Expand Down Expand Up @@ -126,9 +127,11 @@ def setup(self, tel):
# Precalculate the stack properties
self.bt_stack = np.array(
[
(tools.cmap(upp[0], upp[1], self.telescope.nfeed), 0)
if upp[0] <= upp[1]
else (tools.cmap(upp[1], upp[0], self.telescope.nfeed), 1)
(
(tools.cmap(upp[0], upp[1], self.telescope.nfeed), 0)
if upp[0] <= upp[1]
else (tools.cmap(upp[1], upp[0], self.telescope.nfeed), 1)
)
for upp in self.telescope.uniquepairs
],
dtype=[("prod", "<u4"), ("conjugate", "u1")],
Expand All @@ -153,12 +156,10 @@ def setup(self, tel):
self.bt_rev["conjugate"] = np.where(feedmask, self.telescope.feedconj[triu], 0)

@overload
def process(self, ss: containers.SiderealStream) -> containers.SiderealStream:
...
def process(self, ss: containers.SiderealStream) -> containers.SiderealStream: ...

@overload
def process(self, ss: containers.TimeStream) -> containers.TimeStream:
...
def process(self, ss: containers.TimeStream) -> containers.TimeStream: ...

def process(self, ss):
"""Select and reorder the products.
Expand Down
1 change: 1 addition & 0 deletions draco/analysis/wavelet.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Wavelet power spectrum estimation."""

import os

import numpy as np
Expand Down
1 change: 1 addition & 0 deletions draco/core/containers.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
- :py:meth:`empty_like`
- :py:meth:`empty_timestream`
"""

import inspect
from typing import List, Optional, Union

Expand Down
1 change: 1 addition & 0 deletions draco/core/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
single_group:
files: ['file1.h5', 'file2.h5']
"""

import os.path
import shutil
import subprocess
Expand Down
1 change: 0 additions & 1 deletion draco/synthesis/gain.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
"""Tasks for generating random gain fluctuations in the data and stacking them."""


import numpy as np
from caput import config, mpiarray, pipeline

Expand Down
1 change: 1 addition & 0 deletions draco/util/rfi.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Collection of routines for RFI excision."""

import numpy as np
from scipy.ndimage import convolve1d

Expand Down
1 change: 1 addition & 0 deletions draco/util/testing.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""draco test utils."""

from typing import List, Optional, Tuple, Union

import numpy as np
Expand Down
Loading