generated from microsoft/python-package-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
20 changed files
with
254 additions
and
100 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
nro45data.psw module | ||
==================================== | ||
|
||
.. automodule:: nro45data.psw | ||
:members: | ||
:undoc-members: | ||
:show-inheritance: | ||
|
||
Submodules | ||
---------- | ||
|
||
nro45data.psw.io submodule | ||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
|
||
.. automodule:: nro45data.psw.io | ||
:members: _read_psw, _to_fits | ||
:undoc-members: | ||
:show-inheritance: | ||
|
||
nro45data.psw.ms2 submodule | ||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
|
||
.. automodule:: nro45data.psw.ms2 | ||
:members: | ||
:undoc-members: | ||
:show-inheritance: | ||
|
||
nro45data.psw.ms4 submodule | ||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
|
||
.. automodule:: nro45data.psw.ms4 | ||
:members: | ||
:undoc-members: | ||
:show-inheritance: | ||
|
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,4 +4,4 @@ nro45data package | |
.. toctree:: | ||
:maxdepth: 4 | ||
|
||
nro45data.reader | ||
nro45data.psw |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# Configuration file for the Sphinx documentation builder. | ||
# | ||
# For the full list of built-in configuration values, see the documentation: | ||
# https://www.sphinx-doc.org/en/master/usage/configuration.html | ||
|
||
# -- Project information ----------------------------------------------------- | ||
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information | ||
|
||
project = 'nro45data' | ||
copyright = '2024, Takeshi Nakazato' | ||
author = 'Takeshi Nakazato' | ||
release = '0.0.2alpha' | ||
|
||
# -- General configuration --------------------------------------------------- | ||
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration | ||
|
||
extensions = [] | ||
|
||
templates_path = ['_templates'] | ||
exclude_patterns = [] | ||
|
||
|
||
|
||
# -- Options for HTML output ------------------------------------------------- | ||
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output | ||
|
||
html_theme = 'alabaster' | ||
html_static_path = ['_static'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
.. nro45data documentation master file, created by | ||
sphinx-quickstart on Sat Dec 21 14:11:40 2024. | ||
You can adapt this file completely to your liking, but it should at least | ||
contain the root `toctree` directive. | ||
nro45data documentation | ||
======================= | ||
|
||
Add your content using ``reStructuredText`` syntax. See the | ||
`reStructuredText <https://www.sphinx-doc.org/en/master/usage/restructuredtext/index.html>`_ | ||
documentation for details. | ||
|
||
|
||
.. toctree:: | ||
:maxdepth: 2 | ||
:caption: Contents: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
This directoy stores each Python Package. | ||
**This** directoy stores each Python Package. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
from __future__ import annotations | ||
|
||
__version__ = "0.0.2" | ||
__version__ = "1.0.0alpha" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
from .io import _read_psw | ||
from .io import _to_fits | ||
from .ms2 import _to_ms2 | ||
from .ms4 import _to_ms4 | ||
|
||
|
||
def nqm2fits(nqmfile: str, fitsfile: str, overwrite: bool = False) -> bool: | ||
"""Convert NRO45m PSW data (.nqm) to FITS. | ||
Args: | ||
nqmfile: Input NRO45m PSW file name | ||
fitsfile: Output FITS file name | ||
overwrite: Overwrite existing output file or not. | ||
Default is False (not overwrite). | ||
Returns: | ||
Conversion status. True is successful. | ||
""" | ||
hdulist = _read_psw(nqmfile) | ||
return _to_fits(hdulist, fitsfile, overwrite) | ||
|
||
|
||
def nqm2ms2(nqmfile: str, msfile: str, overwrite: bool = False) -> bool: | ||
"""Convert NRO45m PSW data (.nqm) to MeasurementSet v2. | ||
Not implemented yet. | ||
Args: | ||
nqmfile: Input NRO45m PSW file name | ||
msfile: Output MSv2 file name | ||
overwrite: Overwrite existing output file or not. | ||
Default is False (not overwrite). | ||
Returns: | ||
Conversion status. True is successful. | ||
""" | ||
hdulist = _read_psw(nqmfile) | ||
return _to_ms2(hdulist, msfile, overwrite) | ||
|
||
|
||
def nqm2ms4(nqmfile: str, psfile: str, overwrite: bool = False) -> bool: | ||
"""Convert NRO45m PSW data (.nqm) to MeasurementSet v4 (ProcessingSet). | ||
Not implemented yet. | ||
Args: | ||
nqmfile: Input NRO45m PSW file name | ||
psfile: Output MSv4 (ProcessingSet) file name | ||
overwrite: Overwrite existing output file or not. | ||
Default is False (not overwrite). | ||
Returns: | ||
Conversion status. True is successful. | ||
""" | ||
hdulist = _read_psw(nqmfile) | ||
return _to_ms4(hdulist, psfile, overwrite) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
from .reader import _read_psw | ||
from .fits import _to_fits |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
from typing import List, Tuple, TYPE_CHECKING | ||
|
||
import astropy.io.fits as fits | ||
|
||
if TYPE_CHECKING: | ||
from astropy.io.fits.hdu.hdulist import HDUList | ||
|
||
|
||
def _to_fits(hdulist: 'HDUList', fitsfile: str, overwrite: bool = False) -> bool: | ||
"""Export HDUList to FITS. | ||
Args: | ||
hdulist: HDUList generated from NRO 45m PSW file (.nqm) | ||
fitsfile: Output FITS file name | ||
overwrite: Overwrite existing output file or not. | ||
Default is False (not overwrite). | ||
Returns: | ||
Export status. True is successful. | ||
""" | ||
status = True | ||
|
||
primary_hdu = fits.PrimaryHDU() | ||
output_hdulist = fits.HDUList([primary_hdu, hdulist[0]]) | ||
|
||
try: | ||
output_hdulist.writeto( | ||
fitsfile, | ||
output_verify='fix+warn', | ||
overwrite=overwrite | ||
) | ||
except Exception as e: | ||
print(e) | ||
status = False | ||
|
||
return status |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
from typing import TYPE_CHECKING | ||
|
||
if TYPE_CHECKING: | ||
from astropy.io.fits.hdu.hdulist import HDUList | ||
|
||
|
||
def _to_ms2( | ||
hdulist: 'HDUList', | ||
msfile: str, | ||
overwrite: bool = False | ||
) -> bool: | ||
"""Export HDUList to MeasurementSet v2. | ||
Not implemented yet. | ||
Args: | ||
hdulist: HDUList generated from NRO 45m PSW file (.nqm) | ||
fitsfile: Output MSv2 file name | ||
overwrite: Overwrite existing output file or not. | ||
Default is False (not overwrite). | ||
Returns: | ||
Export status. True is successful. | ||
""" | ||
return False |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
from typing import TYPE_CHECKING | ||
|
||
if TYPE_CHECKING: | ||
from astropy.io.fits.hdu.hdulist import HDUList | ||
|
||
|
||
def _to_ms4( | ||
hdulist: 'HDUList', | ||
psfile: str, | ||
overwrite: bool = False | ||
) -> bool: | ||
"""Export HDUList to MeasurementSet v4 (ProcessingSet). | ||
Not implemented yet. | ||
Args: | ||
hdulist: HDUList generated from NRO 45m PSW file (.nqm) | ||
fitsfile: Output PS file name | ||
overwrite: Overwrite existing output file or not. | ||
Default is False (not overwrite). | ||
Returns: | ||
Export status. True is successful. | ||
""" | ||
return False |
Oops, something went wrong.