Skip to content
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
3 changes: 2 additions & 1 deletion .github/codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ coverage:
default:
target: 75%
threshold: 5%
if_ci_failed: error
if_ci_failed: error
patch: off
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
python-version: ['3.9', '3.10', '3.11']
python-version: ['3.10', '3.11', '3.12']

steps:
- uses: actions/checkout@v4
Expand Down
10 changes: 5 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -256,11 +256,11 @@ pyrightconfig.json

### VisualStudioCode ###
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
!.vscode/*.code-snippets
.vscode/settings.json
.vscode/tasks.json
.vscode/launch.json
.vscode/extensions.json
.vscode/*.code-snippets

# Local History for Visual Studio Code
.history/
Expand Down
1 change: 0 additions & 1 deletion docs/api/base.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,5 @@
```{eval-rst}
.. automodule:: sigpyproc.base
:members:
:undoc-members:
:show-inheritance:
```
1 change: 0 additions & 1 deletion docs/api/block.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,5 @@
```{eval-rst}
.. automodule:: sigpyproc.block
:members:
:undoc-members:
:show-inheritance:
```
4 changes: 0 additions & 4 deletions docs/api/core.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
```{eval-rst}
.. automodule:: sigpyproc.core.stats
:members:
:undoc-members:
:show-inheritance:
```

Expand All @@ -14,7 +13,6 @@
```{eval-rst}
.. automodule:: sigpyproc.core.filters
:members:
:undoc-members:
:show-inheritance:
```

Expand All @@ -23,7 +21,6 @@
```{eval-rst}
.. automodule:: sigpyproc.core.rfi
:members:
:undoc-members:
:show-inheritance:

```
Expand All @@ -33,6 +30,5 @@
```{eval-rst}
.. automodule:: sigpyproc.core.kernels
:members:
:undoc-members:
:show-inheritance:
```
1 change: 0 additions & 1 deletion docs/api/foldedcube.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,5 @@
```{eval-rst}
.. automodule:: sigpyproc.foldedcube
:members:
:undoc-members:
:show-inheritance:
```
1 change: 0 additions & 1 deletion docs/api/fourierseries.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,5 @@
```{eval-rst}
.. automodule:: sigpyproc.fourierseries
:members:
:undoc-members:
:show-inheritance:
```
1 change: 0 additions & 1 deletion docs/api/header.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,5 @@
```{eval-rst}
.. automodule:: sigpyproc.header
:members:
:undoc-members:
:show-inheritance:
```
5 changes: 0 additions & 5 deletions docs/api/index.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
# sigpyproc

```{eval-rst}
.. py:module:: sigpyproc

```

## Subpackages

```{toctree}
Expand Down
4 changes: 0 additions & 4 deletions docs/api/io.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
```{eval-rst}
.. automodule:: sigpyproc.io.sigproc
:members:
:undoc-members:
:show-inheritance:
```

Expand All @@ -14,7 +13,6 @@
```{eval-rst}
.. automodule:: sigpyproc.io.bits
:members:
:undoc-members:
:show-inheritance:
```

Expand All @@ -23,7 +21,6 @@
```{eval-rst}
.. automodule:: sigpyproc.io.fileio
:members:
:undoc-members:
:show-inheritance:
```

Expand All @@ -32,6 +29,5 @@
```{eval-rst}
.. automodule:: sigpyproc.io.pfits
:members:
:undoc-members:
:show-inheritance:
```
1 change: 0 additions & 1 deletion docs/api/params.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,5 @@
```{eval-rst}
.. automodule:: sigpyproc.params
:members:
:undoc-members:
:show-inheritance:
```
1 change: 0 additions & 1 deletion docs/api/readers.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,5 @@
```{eval-rst}
.. automodule:: sigpyproc.readers
:members:
:undoc-members:
:show-inheritance:
```
1 change: 0 additions & 1 deletion docs/api/timeseries.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,5 @@
```{eval-rst}
.. automodule:: sigpyproc.timeseries
:members:
:undoc-members:
:show-inheritance:
```
1 change: 0 additions & 1 deletion docs/api/utils.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,5 @@
```{eval-rst}
.. automodule:: sigpyproc.utils
:members:
:undoc-members:
:show-inheritance:
```
7 changes: 6 additions & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
# directories to ignore when looking for source files.
# This pattern also affects html_static_path and html_extra_path.
exclude_patterns = ["_build", "**.ipynb_checkpoints", "Thumbs.db", ".DS_Store"]
default_role = "any"

rst_epilog = f"""
.. |project| replace:: {project}
Expand Down Expand Up @@ -84,14 +85,17 @@
autodoc_member_order = "bysource"
autodoc_typehints = "none"

numpydoc_show_class_members = False
numpydoc_show_class_members = True
numpydoc_show_inherited_class_members = False
numpydoc_class_members_toctree = False
numpydoc_xref_param_type = True
numpydoc_xref_aliases = {
"ndarray": "numpy.ndarray",
"dtype": "numpy.dtype",
"ArrayLike": "numpy.typing.ArrayLike",
"NDArray": "numpy.typing.NDArray",
"float32": "numpy.float32",
"complex64": "numpy.complex64",
"Figure": "matplotlib.figure.Figure",
"scipy": "scipy",
"astropy": "astropy",
Expand Down Expand Up @@ -130,6 +134,7 @@
"astropy": ("https://docs.astropy.org/en/stable/", None),
"attrs": ("https://www.attrs.org/en/stable/", None),
"matplotlib": ("https://matplotlib.org/stable/", None),
"pyfftw": ("https://pyfftw.readthedocs.io/en/latest/", None),
"typing_extensions": ("https://typing-extensions.readthedocs.io/en/stable/", None),
}

Expand Down
52 changes: 27 additions & 25 deletions docs/dev.md
Original file line number Diff line number Diff line change
@@ -1,51 +1,52 @@
(dev)=

# Developer documentation

Here we will cover all the steps required to add new functionality to the
`sigpyproc` package. To do this, we will first consider adding a new function
to the {class}`~sigpyproc.base.Filterbank` class.
to the {py:class}`~sigpyproc.base.Filterbank` class.

## Adding a new function: `bandpass()`

**Aim:** Add a new function called bandpass, which will return the total power
as a function of frequency for our observation.
**Aim:** Add a new function called `bandpass`, which will return the total power
as a function of frequency for the filterbank data.

**Files to be modified:** `sigpyproc/base.py`, `sigpyproc/core/kernels.py`.

### Step 1: Write the API part

The first step is to write the user API of the function. As this function
will run on data with both time and frequency resolution,
it belongs in the {class}`~sigpyproc.base.Filterbank` class.
The first step is to write the user API of the function. As this function will run on
data with both time and frequency resolution, it belongs in the
{py:class}`~sigpyproc.base.Filterbank` class.

```python
def bandpass(self, gulp=512, **kwargs):
def bandpass(self, gulp=16384, **plan_kwargs):
bpass_ar = np.zeros(self.header.nchans, dtype=np.float32)
num_samples = 0
for nsamps, ii, data in self.read_plan(**plan_kwargs):
kernel.extract_bpass(data, bpass_ar, self.header.nchans, nsamps)
kernels.extract_bpass(data, bpass_ar, self.header.nchans, nsamps)
num_samples += nsamps
bpass_ar = bpass_ar / num_samples
return TimeSeries(bpass_ar, self.header.new_header({"nchans": 1}))
bpass_ar /= num_samples
hdr_changes = {"nchans": 1, "nsamples": len(bpass_ar)}
return TimeSeries(bpass_ar, self.header.new_header(hdr_changes))
```

Looking at the important lines, we have:
Return an instance of the {class}`~sigpyproc.timeseries.TimeSeries` class.
The {class}`~sigpyproc.timeseries.TimeSeries` class takes two arguments,
an instance of {py:obj}`numpy.ndarray` and an instance of
{class}`~sigpyproc.header.Header`.

Now we have something similar to a normal {py:obj}`numpy.ndarray`,
which exports several other methods for convenience.
Looking at the important lines, we have returned an instance of the
{py:class}`~sigpyproc.timeseries.TimeSeries` class.
The {py:class}`~sigpyproc.timeseries.TimeSeries` class takes two arguments, an instance
of {py:obj}`numpy.ndarray` and an instance of {py:class}`~sigpyproc.header.Header`.
It exposes several other methods for convenience.

### Step 2: Write the core Numba kernel

We called a kernel function named `extract_bpass`. This function belongs in the
`sigpyproc/core/kernels.py` file. In `kernels.py`, our function looks like:
`sigpyproc/core/kernels.py` file. The function looks like:

```python
@njit(["void(u1[:], f4[:], i4, i4)", "void(f4[:], f4[:], i4, i4)"], cache=True, parallel=True)
@njit(
["void(u1[:], f4[:], i4, i4)", "void(f4[:], f4[:], i4, i4)"],
cache=True,
parallel=True,
fastmath=True,
)
def extract_bpass(inarray, outarray, nchans, nsamps):
for ichan in prange(nchans):
for isamp in range(nsamps):
Expand All @@ -57,9 +58,10 @@ We use the jit compiler directive `parallel` to enable OpenMP threading.

## Reporting an issue

[Post an issue on the GitHub repository](https://github.com/FRBs/sigpyproc3/issues). When you post an issue,
please provide the details to reproduce the issue.
[Post an issue on the GitHub repository](https://github.com/FRBs/sigpyproc3/issues).
When you post an issue, please provide the details to reproduce the issue.

## Contributing code or documentation

An excellent place to start is the [AstroPy developer docs](https://docs.astropy.org/en/stable/development/workflow/development_workflow.html).
An excellent place to start is the
[AstroPy developer docs](https://docs.astropy.org/en/stable/development/workflow/development_workflow.html).
2 changes: 1 addition & 1 deletion docs/modules.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# API Reference

```{toctree}
:titlesonly: true
:titlesonly:

api/index
```
14 changes: 7 additions & 7 deletions docs/tutorials/quickstart.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"## Getting started"
"# Getting started"
]
},
{
Expand All @@ -26,7 +26,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"### Loading data into sigpyproc"
"## Loading data into sigpyproc"
]
},
{
Expand Down Expand Up @@ -257,7 +257,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"### Dedispersing the data"
"## Dedispersing the data"
]
},
{
Expand Down Expand Up @@ -459,7 +459,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"### Performing a Fourier transform"
"## Performing a Fourier transform"
]
},
{
Expand Down Expand Up @@ -693,7 +693,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"### Folding data"
"## Folding data"
]
},
{
Expand Down Expand Up @@ -822,7 +822,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"### Tips and tricks"
"## Tips and tricks"
]
},
{
Expand Down Expand Up @@ -1015,7 +1015,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.9"
"version": "3.11.10"
}
},
"nbformat": 4,
Expand Down
Loading
Loading