Skip to content

Commit

Permalink
First commit of new TF reading class
Browse files Browse the repository at this point in the history
  • Loading branch information
AlanLoh committed Dec 12, 2023
1 parent e1b6bf5 commit e1c19ab
Show file tree
Hide file tree
Showing 56 changed files with 1,502 additions and 1,302 deletions.
2 changes: 2 additions & 0 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ build:
os: ubuntu-22.04
tools:
python: "3.11"
apt_packages:
- graphviz

sphinx:
configuration: docs/conf.py
Expand Down
3 changes: 2 additions & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@
autodoc_mock_imports = [
'pygsm',
'pyvo',
'astroplan'
'astroplan',
'mocpy'
]

default_role = 'obj'
Expand Down
5 changes: 3 additions & 2 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ Finally, observations can then be simulated using the simulated beam and a sky m
io/sst_reading
io/bst_reading
io/xst_reading
io/undysputed_reading
io/tf_reading

.. _data-analysis:

Expand All @@ -130,10 +130,11 @@ Finally, observations can then be simulated using the simulated beam and a sky m
.. _tools:

.. toctree::
:caption: Tools
:caption: Modules
:maxdepth: 2

nenupy.astro
nenupy.io
nenupy.instru
nenupy.observation
nenupy.schedule
Expand Down
164 changes: 164 additions & 0 deletions docs/io/tf_reading.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,164 @@
.. _tf_reading_doc:

UnDySPuTeD Time-Frequency Data
==============================

blabala see tests :class:`~nenupy.io.tf.Spectra` or :meth:`~nenupy.astro.astro_tools.altaz_to_radec`


Reading a spectra file
-----------------------

:class:`~nenupy.io.tf.Spectra`

.. code-block:: python
>>> from nenupy.io import Spectra
>>> sp = Spectra(filename="my_file_0.spectra")
:meth:`~nenupy.io.tf.Spectra.info`

.. code-block:: python
>>> sp.info()
filename: my_file_0.spectra
time_min: 2023-05-27T08:39:02.0000050
time_max: 2023-05-27T08:59:34.2445748
dt: 20.97152 ms
frequency_min: 19.921875 MHz
frequency_max: 57.421875 MHz
df: 3.0517578125 kHz
Available beam indices: ['0']
Pipeline configuration
----------------------

Predefined pipeline steps
^^^^^^^^^^^^^^^^^^^^^^^^^

:attr:`~nenupy.io.tf.Spectra.pipeline` :class:`~nenupy.io.tf.TFPipeline` :class:`~nenupy.io.tf.TFTask`

.. code-block:: python
>>> sp.pipeline.info()
Pipeline configuration:
0 - Correct bandpass
(1 - Remove subband channels)
(2 - Rebin in time)
(3 - Rebin in frequency)
4 - Compute Stokes parameters
.. code-block:: python
>>> sp.pipeline_parameters.info()
channels: 64
dt: 0.02097152 s
df: 3051.7578125 Hz
tmin: 2023-05-27T08:39:02.0000050
tmax: 2023-05-27T08:59:34.2445748
fmin: 19.921875 MHz
fmax: 57.421875 MHz
beam: 0
dispersion_measure: None
rotation_measure: None
rebin_dt: None
rebin_df: None
remove_channels: None
dreambeam_skycoord: None
dreambeam_dt: None
dreambeam_parallactic: True
stokes: I
ignore_volume_warning: False
Pipeline parameter modification
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

.. code-block:: python
>>> from astropy.time import Time
>>> import astropy.units as u
>>> sp.pipeline.parameters["tmin"] = "2023-05-27T08:40:00"
>>> sp.pipeline.parameters["tmax"] = Time("2023-05-27 08:42:00", format="iso")
>>> sp.pipeline.parameters["fmin"] = 50
>>> sp.pipeline.parameters["fmax"] = 55*u.MHz
Managing pipeline tasks
^^^^^^^^^^^^^^^^^^^^^^^

:meth:`~nenupy.io.tf.TFPipeline.remove`

.. code-block:: python
>>> sp.pipeline.remove(2)
>>> sp.pipeline.info()
Pipeline configuration:
0 - Correct bandpass
(1 - Remove subband channels)
(2 - Rebin in frequency)
3 - Compute Stokes parameters
:meth:`~nenupy.io.tf.TFPipeline.insert` :meth:`~nenupy.io.tf.TFPipeline.append`

.. code-block:: python
>>> from nenupy.io.tf import TFTask
>>> sp.pipeline.insert(TFTask.time_rebin(), 1)
>>> sp.pipeline.info()
Pipeline configuration:
0 - Correct bandpass
(1 - Rebin in time)
(2 - Remove subband channels)
(3 - Rebin in frequency)
4 - Compute Stokes parameters
Adding custom steps
^^^^^^^^^^^^^^^^^^^

.. code-block:: python
>>> from nenupy.io.tf import TFTask
>>>
>>> custom_task = TFTask(
name="my task - multiply the data by n_channels",
func=lambda data, channels: data*channels,
args_to_update=["channels"]
)
>>> sp.pipeline.insert(custom_task, 3)
>>> sp.pipeline.info()
Pipeline configuration:
0 - Correct bandpass
(1 - Rebin in time)
(2 - Remove subband channels)
3 - my task - multiply the data by n_channels
(4 - Rebin in frequency)
5 - Compute Stokes parameters
Getting the data
----------------

:meth:`~nenupy.io.tf.Spectra.get`

.. code-block:: python
>>> data = sp.get(stokes="I")
.. code-block:: python
>>> data = sp.get(stokes="I", tmin="2023-05-27T08:41:30")
.. note::

There is a hardcoded size limit to the data output (i.e. after rebinning and all other pipeline operations) fixed at 2 GB, to prevent memory issues.
Users willing to bypass this limit may explicitely ask for it using the `ignore_data_size` argument of :meth:`~nenupy.io.tf.Spectra.get`:

.. code-block:: python
>>> sp.get(tmin="2023-05-27T08:40:00", tmax="2023-05-27T18:00:00", ignore_data_size=True)
4 changes: 2 additions & 2 deletions docs/io/undysputed_reading.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
.. _undysputed_reading_doc:

UnDySPuTeD Time-Frequency Data
==============================
UnDySPuTeD Time-Frequency Data (deprecated)
===========================================

:mod:`~nenupy.undysputed.dynspec.Dynspec` is the module designed to
read and analyze *UnDySPuTeD* DynSpec high-rate data. It
Expand Down
4 changes: 2 additions & 2 deletions docs/nenupy.astro.astro_tools.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
nenupy.astro.astro\_tools
=========================
nenupy.astro.astro\_tools
==========================

.. automodule:: nenupy.astro.astro_tools
:members:
Expand Down
7 changes: 7 additions & 0 deletions docs/nenupy.astro.beam_correction.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
nenupy.astro.beam\_correction
==============================

.. automodule:: nenupy.astro.beam_correction
:members:
:undoc-members:
:show-inheritance:
7 changes: 7 additions & 0 deletions docs/nenupy.astro.jones_mueller.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
nenupy.astro.jones\_mueller
============================

.. automodule:: nenupy.astro.jones_mueller
:members:
:undoc-members:
:show-inheritance:
4 changes: 2 additions & 2 deletions docs/nenupy.astro.pointing.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
nenupy.astro.pointing
=====================
nenupy.astro.pointing
======================

.. automodule:: nenupy.astro.pointing
:members:
Expand Down
2 changes: 2 additions & 0 deletions docs/nenupy.astro.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ nenupy.astro
.. toctree::

nenupy.astro.astro_tools
nenupy.astro.beam_correction
nenupy.astro.jones_mueller
nenupy.astro.pointing
nenupy.astro.sky
nenupy.astro.skymodel
Expand Down
4 changes: 2 additions & 2 deletions docs/nenupy.astro.sky.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
nenupy.astro.sky
================
nenupy.astro.sky
=================

.. automodule:: nenupy.astro.sky
:members:
Expand Down
4 changes: 2 additions & 2 deletions docs/nenupy.astro.skymodel.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
nenupy.astro.skymodel
=====================
nenupy.astro.skymodel
======================

.. automodule:: nenupy.astro.skymodel
:members:
Expand Down
4 changes: 2 additions & 2 deletions docs/nenupy.astro.target.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
nenupy.astro.target
===================
nenupy.astro.target
====================

.. automodule:: nenupy.astro.target
:members:
Expand Down
4 changes: 2 additions & 2 deletions docs/nenupy.astro.uvw.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
nenupy.astro.uvw
================
nenupy.astro.uvw
=================

.. automodule:: nenupy.astro.uvw
:members:
Expand Down
4 changes: 2 additions & 2 deletions docs/nenupy.beamlet.beamlet.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
nenupy.beamlet.beamlet
======================
nenupy.beamlet.beamlet
=======================

.. automodule:: nenupy.beamlet.beamlet
:members:
Expand Down
4 changes: 2 additions & 2 deletions docs/nenupy.beamlet.bstdata.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
nenupy.beamlet.bstdata
======================
nenupy.beamlet.bstdata
=======================

.. automodule:: nenupy.beamlet.bstdata
:members:
Expand Down
4 changes: 2 additions & 2 deletions docs/nenupy.beamlet.sdata.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
nenupy.beamlet.sdata
====================
nenupy.beamlet.sdata
=====================

.. automodule:: nenupy.beamlet.sdata
:members:
Expand Down
4 changes: 2 additions & 2 deletions docs/nenupy.beamlet.sstdata.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
nenupy.beamlet.sstdata
======================
nenupy.beamlet.sstdata
=======================

.. automodule:: nenupy.beamlet.sstdata
:members:
Expand Down
4 changes: 2 additions & 2 deletions docs/nenupy.instru.instrument_tools.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
nenupy.instru.instrument\_tools
===============================
nenupy.instru.instrument\_tools
================================

.. automodule:: nenupy.instru.instrument_tools
:members:
Expand Down
4 changes: 2 additions & 2 deletions docs/nenupy.instru.interferometer.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
nenupy.instru.interferometer
============================
nenupy.instru.interferometer
=============================

.. automodule:: nenupy.instru.interferometer
:members:
Expand Down
7 changes: 7 additions & 0 deletions docs/nenupy.instru.nda.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
nenupy.instru.nda
==================

.. automodule:: nenupy.instru.nda
:members:
:undoc-members:
:show-inheritance:
4 changes: 2 additions & 2 deletions docs/nenupy.instru.nenufar.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
nenupy.instru.nenufar
=====================
nenupy.instru.nenufar
======================

.. automodule:: nenupy.instru.nenufar
:members:
Expand Down
1 change: 1 addition & 0 deletions docs/nenupy.instru.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ nenupy.instru

nenupy.instru.instrument_tools
nenupy.instru.interferometer
nenupy.instru.nda
nenupy.instru.nenufar


Expand Down
4 changes: 2 additions & 2 deletions docs/nenupy.io.bst.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
nenupy.io.bst
=============
nenupy.io.bst
==============

.. automodule:: nenupy.io.bst
:members:
Expand Down
4 changes: 2 additions & 2 deletions docs/nenupy.io.io_tools.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
nenupy.io.io\_tools
===================
nenupy.io.io\_tools
====================

.. automodule:: nenupy.io.io_tools
:members:
Expand Down
2 changes: 2 additions & 0 deletions docs/nenupy.io.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ nenupy.io
nenupy.io.bst
nenupy.io.io_tools
nenupy.io.sst
nenupy.io.tf
nenupy.io.tf_utils
nenupy.io.xst


Expand Down
4 changes: 2 additions & 2 deletions docs/nenupy.io.sst.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
nenupy.io.sst
=============
nenupy.io.sst
==============

.. automodule:: nenupy.io.sst
:members:
Expand Down
Loading

0 comments on commit e1c19ab

Please sign in to comment.