Coder Social home page Coder Social logo

maser4py's Introduction

About maser4py

maser4py offers modules to handle data from several space and ground radio observatory.

It comes with the following submodules:

Read maser4py main documentation for details.

maser4py is developed in the framework of the MASER project.

Installation

To install the full package, run the following command:

pip install maser4py[all]

or use one of the extra options:

  • data to get maser-data submodule features
  • plot to get maser-plot submodule features
  • tools to get maser-tools submodule features
  • jupyter for Jupyter notebook support
  • jupytext for Jupyter notebook text support
  • all to install all the submodules above

For example if you want to use maser4py with maser-data and maser-plot submodules:

pip install maser4py[data,plot]

Usage

Examples of usage can be found in the examples folder.

Examples can also be run as Jupyter notebooks on Binder Binder You can also launch a Binder environment and browse through the notebook examples.

Development

To contribute to the development of the package, you will need to install a local copy of maser4py:

git clone https://gitlab.obspm.fr/maser/maser4py.git

Then, you can install the package locally

Requirements

maser4py requirements are detailed in the pyproject.toml file

poetry

To install the package, it is recommended to use poetry:

pip install poetry

CDF file format

To use maser4py to read CDF files you have to install the CDF library and the spacepy.pycdf package.

Installing a local copy of maser4py

Use the following command to install the package from a local copy:

poetry install

Tests

Use pytest -m "not test_data_required" to skip tests that require test data (and to skip auto download).

pip install -e path/to/project/folder

Build the documentation

Use sphinx-build docs/source docs/public to build the documentation.

Manually publish maser and generate a new DOI

To publish maser with poetry you will have to build a dist package:

poetry build

And then publish the package on pypi (and/or on Gitlab, see https://python-poetry.org/docs/cli/#publish):

poetry publish

maser comes with a Python client (see .ci/zenodo.py) to interact with the Zenodo API and generate automatically a DOI for each new version of maser.

To archive maser on Zenodo:

  1. Create an access token
  2. Is this the first maser deposit on Zenodo ?
  • Yes it's the first deposit, so you don't need any ID
  • No, it's a new version of maser. Then browse to the first record of maser on Zenodo and check the URL : https://zenodo.org/record/<DEPOSITION_ID> to get the maser deposition ID.
  1. Use the following command to deposit the package on Zenodo:
 python .ci/zenodo.py -p ./ -t <ACCESS_TOKEN> -a ./dist/maser4py-X.Y.Z.tar.gz  -id <DEPOSITION_ID>
  1. Browse to the maser record on Zenodo, check the metadata/files and publish the package to finally generate the DOI.

Notes :

  • the --sandbox keyword can be used to deposit files on the Zenodo test server
  • the --publish keyword can be used to automatically publish the new record and generate the DOI. But be careful, once published, there is no way to modify a record on Zenodo without publishing a new version.

maser4py's People

Contributors

baptistececconi avatar quynhnhunguyen avatar septaris avatar xbonnin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

maser4py's Issues

Comparison of floating point array with CDF-compare

Syntax command : maser cdf_compare file1.cdf file2.cdf

{
    "gAttrs": {
        "Value": {
            "Data_version": [
                "02",
                "0.7.0/lfr_surv_asm_l2/inputs/ROC-SGSE_L1_RPW-LFR-SURV-ASM_2a6f4db_CNE_V02",
            ],
            "Generation_date": [
                "2019-10-24T16-08-37",
                "2019-11-07T13-18-56",
            ],
        }
    },
    "zVars": {
        "Value": {
            "ASM_IM_F0": [
                array(
                    [
                        3.23117427e-27,
                        -8.10363745e-11,
                        8.10363745e-11,
                        ...,
                        3.29491159e-15,
                        2.45289366e-13,
                        -1.53946614e-15,
                    ]
                ),
                array(
                    [
                        4.03896783e-27,
                        -8.10363745e-11,
                        8.10363745e-11,
                        ...,
                        3.29491159e-15,
                        2.45289366e-13,
                        -1.53946614e-15,
                    ]
                ),
            ],
            "ASM_IM_F1": [
                array(
                    [
                        -1.45926003e-09,
                        -4.32949188e-09,
                        1.45926003e-09,
                        ...,
                        5.78852278e-15,
                        6.76348430e-13,
                        -5.78852278e-15,
                    ]
                ),
                array(
                    [
                        -1.45926003e-09,
                        -4.32949188e-09,
                        1.45926003e-09,
                        ...,
                        5.78852278e-15,
                        6.76348430e-13,
                        -5.78852278e-15,
                    ]
                ),
            ],
            "ASM_IM_F2": [
                array(
                    [
                        2.72744048e-06,
                        -4.48738931e-05,
                        2.09642584e-08,
                        ...,
                        -2.51295356e-10,
                        -4.95130181e-13,
                        0.00000000e00,
                    ]
                ),
                array(
                    [
                        2.72744048e-06,
                        -4.48738931e-05,
                        2.09642584e-08,
                        ...,
                        -2.51295356e-10,
                        -4.95130181e-13,
                        1.00974196e-28,
                    ]
                ),
            ],
            "ASM_RE_F0": [
                array(
                    [
                        -1.05738053e-11,
                        -8.31795541e-13,
                        -1.05738053e-11,
                        ...,
                        -1.22555621e-12,
                        2.00465545e-14,
                        6.41460982e-14,
                    ]
                ),
                array(
                    [
                        -1.05738053e-11,
                        -8.31795541e-13,
                        -1.05738053e-11,
                        ...,
                        -1.22555621e-12,
                        2.00465545e-14,
                        6.41460982e-14,
                    ]
                ),
            ],
            "ASM_RE_F1": [
                array(
                    [
                        2.15521767e-08,
                        2.89474961e-09,
                        -1.03018530e-10,
                        ...,
                        2.17048209e-13,
                        9.67431261e-15,
                        9.67431261e-15,
                    ]
                ),
                array(
                    [
                        2.15521767e-08,
                        2.89474961e-09,
                        -1.03018530e-10,
                        ...,
                        2.17048209e-13,
                        9.67431261e-15,
                        9.67431261e-15,
                    ]
                ),
            ],
            "ASM_RE_F2": [
                array(
                    [
                        4.26406756e-05,
                        -3.78880216e-09,
                        4.30724502e-05,
                        ...,
                        -3.39557318e-11,
                        -8.63995903e-16,
                        2.45764485e-12,
                    ]
                ),
                array(
                    [
                        4.26406756e-05,
                        -3.78880216e-09,
                        4.30724502e-05,
                        ...,
                        -3.39557318e-11,
                        -8.63995903e-16,
                        2.45764485e-12,
                    ]
                ),
            ],
        }
    },
}

Voyager test or example

Hello folks,

I am trying to read in some Voyager data using the VgPra3RdrLowband6secV1Data class but there is no documentation so I am getting bogged down in the source code. The data I want to work with is the 6sec Uranus data (VG2_URN_PRA_6SEC.TAB) any pointers would be much appreciated.

i.e. the following

`from maser.data.pds.vg.sweeps import VgPra3RdrLowband6secV1Sweep

header = 'DATA/VG2_URN_PRA_6SEC.LBL'
main_file = 'DATA/VG2_URN_PRA_6SEC.TAB'
data = VgPra3RdrLowband6secV1Sweep(header, main_file)`

yields

'/Users/oj/Desktop/Uranus Lightning/data-reader.py in line 14
12 header = 'DATA/VG2_URN_PRA_6SEC.LBL'
13 main_file = 'DATA/VG2_URN_PRA_6SEC.TAB'
---> 14 data = VgPra3RdrLowband6secV1Sweep(header, main_file)
15 # data = Vg2NPra3RdrLowband6secV1Data()

File ~/anaconda3/envs/padme/lib/python3.11/site-packages/maser/data/pds/vg/sweeps.py:10, in VgPra3RdrLowband6secV1Sweep.init(self, header, data)
8 def init(self, header, data):
9 super().init(header, data)
---> 10 self._frequencies = header["frequencies"]
11 self._time = header["time"]
12 self.header["sweep_type"] = self._get_sweep_type()

TypeError: string indices must be integers, not 'str''

execution fails

I have an execution error, when using master or develop on the Nançay das2server.
It is related to maser/services/helio/hfc/hfcviewer.py, although I don't use it:

Traceback (most recent call last):
  File "/usr/local/bin/das2rdr/das2nancay/das2_maser_nda_routine.py", line 11, in <module>
    from  maser.data.nancay.nda import routine
  File "/usr/local/lib/python3.5/dist-packages/maser4py-0.8.2-py3.5.egg/maser/__init__.py", line 4, in <module>
    from maser.script import main
  File "/usr/local/lib/python3.5/dist-packages/maser4py-0.8.2-py3.5.egg/maser/script.py", line 22, in <module>
    from maser.services.helio.hfc import hfcviewer, add_hfcviewer_subparser
  File "/usr/local/lib/python3.5/dist-packages/maser4py-0.8.2-py3.5.egg/maser/services/helio/hfc/__init__.py", line 2, in <module>
    from maser.services.helio.hfc.subparser import add_hfcviewer_subparser
  File "/usr/local/lib/python3.5/dist-packages/maser4py-0.8.2-py3.5.egg/maser/services/helio/hfc/subparser.py", line 8, in <module>
    from maser.services.helio.hfc.hfcviewer import DATE, OBSERVATORY, INSTRUMENT, TELESCOPE, WAVENAME, URL_WSDL
  File "/usr/local/lib/python3.5/dist-packages/maser4py-0.8.2-py3.5.egg/maser/services/helio/hfc/hfcviewer.py", line 19, in <module>
    from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg, NavigationToolbar2Tk
ImportError: cannot import name 'NavigationToolbar2Tk'

If I replace

from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg, NavigationToolbar2Tk

by

from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg, NavigationToolbar2TkAgg

in maser/services/helio/hfc/hfcviewer.py, the error disappears. I didn't check if hfcviewer.py is broken after this, but I can use maser4py here.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.