Skip to content

Commit

Permalink
#14 Merge pull request from b4r-dev/astropenguin/issue11
Browse files Browse the repository at this point in the history
Rename project
  • Loading branch information
astropenguin authored Jul 9, 2024
2 parents 079793a + 935f0e9 commit 2461f22
Show file tree
Hide file tree
Showing 20 changed files with 469 additions and 1,188 deletions.
10 changes: 5 additions & 5 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
{
"name": "b4rpipe",
"image": "python:3.10",
"name": "b4r",
"image": "python:3.11",
"runArgs": [
"--name=b4rpipe",
"--name=b4r",
"--platform=linux/amd64"
],
"containerEnv": {
"POETRY_VIRTUALENVS_CREATE": "false"
},
"onCreateCommand": "pip install poetry",
"postCreateCommand": "poetry install==1.8.2",
"onCreateCommand": "pip install poetry==1.8.3",
"postCreateCommand": "poetry install",
"customizations": {
"vscode": {
"extensions": [
Expand Down
22 changes: 22 additions & 0 deletions .github/workflows/pypi.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: PyPI

on:
release:
types:
- created

jobs:
job:
name: PyPI
runs-on: ubuntu-latest
env:
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_TOKEN }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.11"
- uses: abatilo/actions-poetry@v3
with:
poetry-version: "1.8.3"
- run: poetry publish --build
33 changes: 33 additions & 0 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Tests

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
job:
name: Test (Python ${{ matrix.python }})
runs-on: ubuntu-latest
env:
POETRY_VIRTUALENVS_CREATE: false
PYTHON_DIRS: b4r
strategy:
fail-fast: false
matrix:
python: ["3.9", "3.10", "3.11"]
steps:
- uses: actions/checkout@v4
with:
submodules: true
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
- uses: abatilo/actions-poetry@v3
with:
poetry-version: "1.8.3"
- run: poetry install
- run: black --check ${PYTHON_DIRS}
14 changes: 14 additions & 0 deletions CITATION.cff
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
cff-version: 1.2.0
message: "If you use this software, please cite it as below."

title: "b4r"
abstract: "Reduction and analysis tools for LMT/B4R"
version: 2024.7.0
date-released: 2024-07-09
license: "MIT"
url: "https://github.com/b4r-dev/b4r"
authors:
- given-names: "Akio"
family-names: "Taniguchi"
affiliation: "Nagoya University"
orcid: "https://orcid.org/0000-0002-9695-6183"
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2024 Akio Taniguchi

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
124 changes: 49 additions & 75 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,93 +1,70 @@
# b4rpipe
# b4r

[![](https://img.shields.io/pypi/v/b4rpipe.svg?label=PyPI&style=flat-square)](https://pypi.org/pypi/b4rpipe/)
[![](https://img.shields.io/pypi/pyversions/b4rpipe.svg?label=Python&color=yellow&style=flat-square)](https://pypi.org/pypi/b4rpipe/)
[![License](https://img.shields.io/badge/license-MIT-blue.svg?label=License&style=flat-square)](LICENSE)
[![Release](https://img.shields.io/pypi/v/b4r?label=Release&color=cornflowerblue&style=flat-square)](https://pypi.org/project/b4r/)
[![Python](https://img.shields.io/pypi/pyversions/b4r?label=Python&color=cornflowerblue&style=flat-square)](https://pypi.org/project/b4r/)
[![Downloads](https://img.shields.io/pypi/dm/b4r?label=Downloads&color=cornflowerblue&style=flat-square)](https://pepy.tech/project/b4r)
[![Tests](https://img.shields.io/github/actions/workflow/status/b4r-dev/b4r/tests.yaml?label=Tests&style=flat-square)](https://github.com/b4r-dev/b4r/actions)

Pipeline reduction tools for B4R/LMT data.
Reduction and analysis tools for LMT/B4R

**************************************************************
Installation
**************************************************************
## Installation

```terminal
$ pip install b4rpipe
```shell
pip install b4r==2024.7.0
```

**************************************************************
Usage
**************************************************************
## Usage

### Reduce individual data

```terminal
$ python
$ >>> import b4rpipe as Bp
$ >>> Bp.globBaseDir = '/home/hoge/b4r'
$ >>> Bp.globLogDir = '/home/hoge/b4r/logv1'
$ >>> Bp.PipelineAnalysis(86420)
```python
import b4r.pipe as Bp


Bp.globBaseDir = '/home/hoge/b4r'
Bp.globLogDir = '/home/hoge/b4r/logv1'
Bp.PipelineAnalysis(86420)
```

This example shows a pipeline analysis for the data obsid 86420.
This example shows a pipeline analysis for the data obsid `86420`.

### Reduce all data (for database)

```terminal
$ python
$ >>> import b4rpipe as Bp
$ >>> Bp.globBaseDir = '/home/hoge/b4r'
$ >>> Bp.globLogDir = '/home/hoge/b4r/logv1'
$ >>> Bp.PipelineAnalysisBatchRun()
```python
import b4r.pipe as Bp

Bp.globBaseDir = '/home/hoge/b4r'
Bp.globLogDir = '/home/hoge/b4r/logv1'
Bp.PipelineAnalysisBatchRun()
```

You need to specify following pathes.
#### b4pipe.globBaseDir
* The path where "xffts" and "lmttpm" directorys are located.
* XFFTS binary data (e.g., xffts20181003111006.xfftsx.01) should be stored under the "xffts" directory.
* LMT antenna log data (e.g., lmttpm_2018-04-22_075858_01_0000.nc) should be stored under the "lmttpm" directory.

#### b4rpipe.globLogDir
* The path where outputs are created.
* Anywhere you like is OK.

**************************************************************
Products
**************************************************************
The script create following outputs (if possible).

* Continuum Map Qlook (Pointing offset, efficiency (only for uranus), etc.)
* Line (SiO) Map Qlook (Pointing offset, etc.)
* Spectrum Qlook (with auto-flag)
* Time series spectrum of PSW data (numpy readable format)
* GoDec calibration results (see Taniguch et al. 2021)
* MS2 (CASA readable format)

**************************************************************
Data query and download (only for internal use now)
**************************************************************
If you are in the NAOJ or IoA (U. Tokyo) local network, you can access the B4R ftp server.

```terminal
$ python
$ >>> import b4rpipe as Bp
$ >>> Bp.PipelineAnalysis(86420,DataDownload=True,username='hogehoge',password='*****')
```
#### b4r.pipe.globBaseDir

Then "rawdata" and "calibrated" directory appears at the current directory.
- The path where `xffts` and `lmttpm` directories are located.
- XFFTS binary data (e.g., `xffts20181003111006.xfftsx.01`) should be stored under the `xffts` directory.
- LMT antenna log data (e.g., `lmttpm_2018-04-22_075858_01_0000.nc`) should be stored under the `lmttpm` directory.

```terminal
$ ls
raw calibrated
$ ls rawdata
lmttpm xffts
$ls calibrated
86420
```
#### b4r.pipe.globLogDir

- The path where outputs are created.
- Anywhere you like is OK.

**************************************************************
Correspondence
**************************************************************
+ B4R 2018/2019 (obsnum<=087433) data <-> CASA MS2
## Products

The script create following outputs (if possible).

- Continuum Map Qlook (Pointing offset, efficiency (only for uranus), etc.)
- Line (SiO) Map Qlook (Pointing offset, etc.)
- Spectrum Qlook (with auto-flag)
- Time series spectrum of PSW data (NumPy readable format)
- GoDec calibration results (see Taniguchi et al. 2021)
- MS2 (CASA readable format)

## Correspondence

B4R 2018/2019 (obsnum<=087433) data <-> CASA MS2:

| Name | B4R | CASA MS2 |
| --- | --- | --- |
Expand All @@ -96,9 +73,6 @@ Correspondence
| sideband | LSB | spw 0 |
| sideband | USB | spw 1 |

**************************************************************
Information
**************************************************************
* B4R webpage: http://lmtgtm.org/b4r/?lang=en
* Contact: Yuki Yoshimura
(email: astro.yoshimura(_at_)gmail.com)
## Information

- B4R webpage: http://lmtgtm.org/b4r/?lang=en
6 changes: 6 additions & 0 deletions b4r/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
__all__ = ["pipe"]
__version__ = "2024.7.0"


# subpackages
from . import pipe
File renamed without changes.
6 changes: 3 additions & 3 deletions b4rpipe/LibB4Rtools.py → b4r/pipe/LibB4Rtools.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@
iers.conf.auto_max_age = None

# submodules
import b4rpipe.makedatalist as md
import b4rpipe.specfile4 as sp
import b4rpipe.CreateMs2 as ms2
import b4r.pipe.makedatalist as md
import b4r.pipe.specfile4 as sp
import b4r.pipe.CreateMs2 as ms2

globBaseDir = "./rawdata"
globLogDir = "./calibrated"
Expand Down
1 change: 1 addition & 0 deletions b4r/pipe/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from b4r.pipe.main import *
2 changes: 1 addition & 1 deletion b4rpipe/b4rquery.py → b4r/pipe/b4rquery.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from ftplib import FTP
import b4rpipe.specfile4 as sp
import b4r.pipe.specfile4 as sp
import sys
import os

Expand Down
File renamed without changes.
8 changes: 4 additions & 4 deletions b4rpipe/main.py → b4r/pipe/main.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#!/usr/bin/env python3
from typing import Optional
import b4rpipe.LibB4Rtools as Lib
import b4rpipe.b4rquery as b4rQ
import b4rpipe.godec as godec
import b4rpipe as Bp
import b4r.pipe.LibB4Rtools as Lib
import b4r.pipe.b4rquery as b4rQ
import b4r.pipe.godec as godec
import b4r.pipe as Bp

# import importlib
import os
Expand Down
2 changes: 1 addition & 1 deletion b4rpipe/makedatalist.py → b4r/pipe/makedatalist.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import glob
import re
import netCDF4 as nc
import b4rpipe.specfile4 as sp
import b4r.pipe.specfile4 as sp
import numpy as np
import math as ma

Expand Down
File renamed without changes.
8 changes: 0 additions & 8 deletions b4rpipe/__init__.py

This file was deleted.

Loading

0 comments on commit 2461f22

Please sign in to comment.