Skip to content

Commit eb2d2fa

Browse files
authored
#4 Merge pull request from astropenguin/astropenguin/issue3
Add module for SAM45 reader
2 parents a19e2bf + 2136813 commit eb2d2fa

17 files changed

Lines changed: 1114 additions & 13 deletions

File tree

.devcontainer/devcontainer.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
"extensions": [
1414
"ms-python.black-formatter",
1515
"ms-python.python",
16-
"ms-toolsai.jupyter",
1716
"streetsidesoftware.code-spell-checker",
1817
"tamasfe.even-better-toml"
1918
],

.github/CODE_OF_CONDUCT.md

Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
# Contributor Covenant Code of Conduct
2+
3+
## Our Pledge
4+
5+
We as members, contributors, and leaders pledge to make participation in our
6+
community a harassment-free experience for everyone, regardless of age, body
7+
size, visible or invisible disability, ethnicity, sex characteristics, gender
8+
identity and expression, level of experience, education, socio-economic status,
9+
nationality, personal appearance, race, religion, or sexual identity
10+
and orientation.
11+
12+
We pledge to act and interact in ways that contribute to an open, welcoming,
13+
diverse, inclusive, and healthy community.
14+
15+
## Our Standards
16+
17+
Examples of behavior that contributes to a positive environment for our
18+
community include:
19+
20+
* Demonstrating empathy and kindness toward other people
21+
* Being respectful of differing opinions, viewpoints, and experiences
22+
* Giving and gracefully accepting constructive feedback
23+
* Accepting responsibility and apologizing to those affected by our mistakes,
24+
and learning from the experience
25+
* Focusing on what is best not just for us as individuals, but for the
26+
overall community
27+
28+
Examples of unacceptable behavior include:
29+
30+
* The use of sexualized language or imagery, and sexual attention or
31+
advances of any kind
32+
* Trolling, insulting or derogatory comments, and personal or political attacks
33+
* Public or private harassment
34+
* Publishing others' private information, such as a physical or email
35+
address, without their explicit permission
36+
* Other conduct which could reasonably be considered inappropriate in a
37+
professional setting
38+
39+
## Enforcement Responsibilities
40+
41+
Community leaders are responsible for clarifying and enforcing our standards of
42+
acceptable behavior and will take appropriate and fair corrective action in
43+
response to any behavior that they deem inappropriate, threatening, offensive,
44+
or harmful.
45+
46+
Community leaders have the right and responsibility to remove, edit, or reject
47+
comments, commits, code, wiki edits, issues, and other contributions that are
48+
not aligned to this Code of Conduct, and will communicate reasons for moderation
49+
decisions when appropriate.
50+
51+
## Scope
52+
53+
This Code of Conduct applies within all community spaces, and also applies when
54+
an individual is officially representing the community in public spaces.
55+
Examples of representing our community include using an official e-mail address,
56+
posting via an official social media account, or acting as an appointed
57+
representative at an online or offline event.
58+
59+
## Enforcement
60+
61+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
62+
reported to the community leaders responsible for enforcement at
63+
a-taniguchi@mail.kitami-it.ac.jp.
64+
All complaints will be reviewed and investigated promptly and fairly.
65+
66+
All community leaders are obligated to respect the privacy and security of the
67+
reporter of any incident.
68+
69+
## Enforcement Guidelines
70+
71+
Community leaders will follow these Community Impact Guidelines in determining
72+
the consequences for any action they deem in violation of this Code of Conduct:
73+
74+
### 1. Correction
75+
76+
**Community Impact**: Use of inappropriate language or other behavior deemed
77+
unprofessional or unwelcome in the community.
78+
79+
**Consequence**: A private, written warning from community leaders, providing
80+
clarity around the nature of the violation and an explanation of why the
81+
behavior was inappropriate. A public apology may be requested.
82+
83+
### 2. Warning
84+
85+
**Community Impact**: A violation through a single incident or series
86+
of actions.
87+
88+
**Consequence**: A warning with consequences for continued behavior. No
89+
interaction with the people involved, including unsolicited interaction with
90+
those enforcing the Code of Conduct, for a specified period of time. This
91+
includes avoiding interactions in community spaces as well as external channels
92+
like social media. Violating these terms may lead to a temporary or
93+
permanent ban.
94+
95+
### 3. Temporary Ban
96+
97+
**Community Impact**: A serious violation of community standards, including
98+
sustained inappropriate behavior.
99+
100+
**Consequence**: A temporary ban from any sort of interaction or public
101+
communication with the community for a specified period of time. No public or
102+
private interaction with the people involved, including unsolicited interaction
103+
with those enforcing the Code of Conduct, is allowed during this period.
104+
Violating these terms may lead to a permanent ban.
105+
106+
### 4. Permanent Ban
107+
108+
**Community Impact**: Demonstrating a pattern of violation of community
109+
standards, including sustained inappropriate behavior, harassment of an
110+
individual, or aggression toward or disparagement of classes of individuals.
111+
112+
**Consequence**: A permanent ban from any sort of public interaction within
113+
the community.
114+
115+
## Attribution
116+
117+
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
118+
version 2.0, available at
119+
https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
120+
121+
Community Impact Guidelines were inspired by [Mozilla's code of conduct
122+
enforcement ladder](https://github.com/mozilla/diversity).
123+
124+
[homepage]: https://www.contributor-covenant.org
125+
126+
For answers to common questions about this code of conduct, see the FAQ at
127+
https://www.contributor-covenant.org/faq. Translations are available at
128+
https://www.contributor-covenant.org/translations.

.github/workflows/docs.yaml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: Docs
2+
3+
on:
4+
release:
5+
types:
6+
- created
7+
8+
jobs:
9+
job:
10+
name: Docs
11+
runs-on: ubuntu-latest
12+
container: ghcr.io/astral-sh/uv:python3.12-bookworm
13+
env:
14+
UV_PROJECT_ENVIRONMENT: /usr/local
15+
permissions:
16+
contents: write
17+
steps:
18+
- uses: actions/checkout@v4
19+
- run: uv sync --frozen
20+
- run: docs/build
21+
- uses: peaceiris/actions-gh-pages@v4
22+
with:
23+
github_token: ${{ secrets.GITHUB_TOKEN }}
24+
publish_dir: ./docs/_build
25+
keep_files: true

.github/workflows/tests.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,6 @@ jobs:
2929
- uses: actions/checkout@v4
3030
- run: uv sync --frozen
3131
- run: black --check ${PYTHON_DIRS}
32+
- run: pyright ${PYTHON_DIRS}
33+
- run: pytest -v tests
34+
- run: docs/build

.gitignore

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ instance/
6969
.scrapy
7070

7171
# Sphinx documentation
72+
docs/_apidoc/
7273
docs/_build/
7374

7475
# PyBuilder
@@ -182,9 +183,9 @@ cython_debug/
182183
.abstra/
183184

184185
# Visual Studio Code
185-
# Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
186+
# Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
186187
# that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
187-
# and can be added to the global gitignore or merged into this file. However, if you prefer,
188+
# and can be added to the global gitignore or merged into this file. However, if you prefer,
188189
# you could uncomment the following to ignore the entire vscode folder
189190
# .vscode/
190191

CITATION.cff

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# This CITATION.cff file was generated with cffinit.
2+
# Visit https://bit.ly/cffinit to generate yours today!
3+
4+
cff-version: 1.2.0
5+
title: sam45
6+
message: >-
7+
If you use this software, please cite it using the
8+
metadata from this file.
9+
type: software
10+
authors:
11+
- given-names: Akio
12+
family-names: Taniguchi
13+
email: a-taniguchi@mail.kitami-it.ac.jp
14+
affiliation: Kitami Institute of Technology
15+
orcid: 'https://orcid.org/0000-0002-9695-6183'
16+
repository-code: 'https://github.com/astropenguin/sam45'
17+
url: 'https://astropenguin.github.io/sam45'
18+
abstract: NRO/SAM45 log data reader
19+
keywords:
20+
- astronomy
21+
- nro
22+
- python
23+
- radio-astronomy
24+
- sam45
25+
license: MIT
26+
version: 1.0.0rc1
27+
date-released: '2025-12-25'

README.md

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,41 @@
1-
# sam45
1+
# SAM45
2+
3+
[![Release](https://img.shields.io/pypi/v/sam45?label=Release&color=cornflowerblue&style=flat-square)](https://pypi.org/project/sam45/)
4+
[![Python](https://img.shields.io/pypi/pyversions/sam45?label=Python&color=cornflowerblue&style=flat-square)](https://pypi.org/project/sam45/)
5+
[![Downloads](https://img.shields.io/pypi/dm/sam45?label=Downloads&color=cornflowerblue&style=flat-square)](https://pepy.tech/project/sam45)
6+
[![Tests](https://img.shields.io/github/actions/workflow/status/astropenguin/45m/tests.yaml?label=Tests&style=flat-square)](https://github.com/astropenguin/sam45/actions)
7+
28
NRO/SAM45 log data reader
9+
10+
## Installation
11+
12+
```shell
13+
pip install sam45
14+
```
15+
16+
## Usage
17+
18+
The following functions will read a SAM45 log to extract each information as [a NumPy structured array](https://numpy.org/doc/stable/user/basics.rec.html).
19+
20+
```python
21+
import sam45
22+
23+
data_ctl = sam45.read.ctl("/path/to/log")
24+
data_obs = sam45.read.obs("/path/to/log")
25+
data_dat = sam45.read.dat("/path/to/log")
26+
data_end = sam45.read.end("/path/to/log")
27+
```
28+
29+
## Data types
30+
31+
The data type of each information is defined as [a NumPy structured data type](https://numpy.org/doc/stable/reference/arrays.dtypes.html).
32+
It complies with the definition as of December 5, 2025.
33+
34+
```python
35+
import sam45
36+
37+
dtype_ctl = sam45.dtypes.ctl
38+
dtype_obs = sam45.dtypes.obs
39+
dtype_dat = sam45.dtypes.dat
40+
dtype_end = sam45.dtypes.end
41+
```

docs/_static/switcher.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
[
2+
{
3+
"name": "1.0.0rc1 (latest)",
4+
"version": "1.0.0rc1",
5+
"url": "https://astropenguin.github.io/sam45/"
6+
}
7+
]

docs/build

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/bin/bash -eu
2+
3+
export LANG=C.UTF-8
4+
export LC_ALL=C.UTF-8
5+
6+
sphinx-apidoc -efMT -d 2 -o docs/_apidoc sam45
7+
sphinx-build -a -b html docs docs/_build
8+
sphinx-build -a -b html docs docs/_build/1.0.0rc1

docs/conf.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
copyright = "2025 Akio Taniguchi"
2+
extensions = [
3+
"myst_parser",
4+
"sphinx.ext.autodoc",
5+
"sphinx.ext.autosummary",
6+
"sphinx.ext.napoleon",
7+
"sphinx.ext.viewcode",
8+
]
9+
html_static_path = ["_static"]
10+
html_theme = "pydata_sphinx_theme"
11+
html_theme_options = {
12+
"github_url": "https://github.com/astropenguin/sam45",
13+
"logo": {"text": "SAM45"},
14+
"navbar_end": [
15+
"version-switcher",
16+
"theme-switcher",
17+
"navbar-icon-links",
18+
],
19+
"switcher": {
20+
"json_url": "https://astropenguin.github.io/sam45/_static/switcher.json",
21+
"version_match": "1.0.0rc1",
22+
},
23+
}

0 commit comments

Comments
 (0)