Skip to content

Commit

Permalink
TF: smooth subband, Doc update
Browse files Browse the repository at this point in the history
  • Loading branch information
AlanLoh committed Jul 23, 2024
1 parent c74b3d5 commit db5a10d
Show file tree
Hide file tree
Showing 12 changed files with 500 additions and 109 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,18 +44,15 @@
~JonesMatrix.getfield
~JonesMatrix.half_waveplate_retarder
~JonesMatrix.item
~JonesMatrix.itemset
~JonesMatrix.left_circular
~JonesMatrix.linear
~JonesMatrix.linear_retarder
~JonesMatrix.max
~JonesMatrix.mean
~JonesMatrix.min
~JonesMatrix.newbyteorder
~JonesMatrix.nonzero
~JonesMatrix.partition
~JonesMatrix.prod
~JonesMatrix.ptp
~JonesMatrix.put
~JonesMatrix.quarter_waveplate_retarder
~JonesMatrix.ravel
Expand All @@ -73,6 +70,7 @@
~JonesMatrix.sum
~JonesMatrix.swapaxes
~JonesMatrix.take
~JonesMatrix.to_device
~JonesMatrix.to_mueller
~JonesMatrix.tobytes
~JonesMatrix.tofile
Expand All @@ -95,13 +93,18 @@
~JonesMatrix.base
~JonesMatrix.ctypes
~JonesMatrix.data
~JonesMatrix.device
~JonesMatrix.dtype
~JonesMatrix.flags
~JonesMatrix.flat
~JonesMatrix.imag
~JonesMatrix.itemset
~JonesMatrix.itemsize
~JonesMatrix.mT
~JonesMatrix.nbytes
~JonesMatrix.ndim
~JonesMatrix.newbyteorder
~JonesMatrix.ptp
~JonesMatrix.real
~JonesMatrix.shape
~JonesMatrix.size
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,17 +45,14 @@
~JonesVector.getfield
~JonesVector.horizontal
~JonesVector.item
~JonesVector.itemset
~JonesVector.left_circular
~JonesVector.linear
~JonesVector.max
~JonesVector.mean
~JonesVector.min
~JonesVector.newbyteorder
~JonesVector.nonzero
~JonesVector.partition
~JonesVector.prod
~JonesVector.ptp
~JonesVector.put
~JonesVector.ravel
~JonesVector.repeat
Expand All @@ -72,6 +69,7 @@
~JonesVector.sum
~JonesVector.swapaxes
~JonesVector.take
~JonesVector.to_device
~JonesVector.to_stokes
~JonesVector.tobytes
~JonesVector.tofile
Expand All @@ -95,13 +93,18 @@
~JonesVector.base
~JonesVector.ctypes
~JonesVector.data
~JonesVector.device
~JonesVector.dtype
~JonesVector.flags
~JonesVector.flat
~JonesVector.imag
~JonesVector.itemset
~JonesVector.itemsize
~JonesVector.mT
~JonesVector.nbytes
~JonesVector.ndim
~JonesVector.newbyteorder
~JonesVector.ptp
~JonesVector.real
~JonesVector.shape
~JonesVector.size
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,18 +44,15 @@
~MuellerMatrix.getfield
~MuellerMatrix.half_waveplate_retarder
~MuellerMatrix.item
~MuellerMatrix.itemset
~MuellerMatrix.left_circular
~MuellerMatrix.linear
~MuellerMatrix.linear_retarder
~MuellerMatrix.max
~MuellerMatrix.mean
~MuellerMatrix.min
~MuellerMatrix.newbyteorder
~MuellerMatrix.nonzero
~MuellerMatrix.partition
~MuellerMatrix.prod
~MuellerMatrix.ptp
~MuellerMatrix.put
~MuellerMatrix.quarter_waveplate_retarder
~MuellerMatrix.ravel
Expand All @@ -73,6 +70,7 @@
~MuellerMatrix.sum
~MuellerMatrix.swapaxes
~MuellerMatrix.take
~MuellerMatrix.to_device
~MuellerMatrix.to_hermitian
~MuellerMatrix.to_jones
~MuellerMatrix.tobytes
Expand All @@ -96,13 +94,18 @@
~MuellerMatrix.base
~MuellerMatrix.ctypes
~MuellerMatrix.data
~MuellerMatrix.device
~MuellerMatrix.dtype
~MuellerMatrix.flags
~MuellerMatrix.flat
~MuellerMatrix.imag
~MuellerMatrix.itemset
~MuellerMatrix.itemsize
~MuellerMatrix.mT
~MuellerMatrix.nbytes
~MuellerMatrix.ndim
~MuellerMatrix.newbyteorder
~MuellerMatrix.ptp
~MuellerMatrix.real
~MuellerMatrix.shape
~MuellerMatrix.size
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,17 +45,14 @@
~PolarVector.getfield
~PolarVector.horizontal
~PolarVector.item
~PolarVector.itemset
~PolarVector.left_circular
~PolarVector.linear
~PolarVector.max
~PolarVector.mean
~PolarVector.min
~PolarVector.newbyteorder
~PolarVector.nonzero
~PolarVector.partition
~PolarVector.prod
~PolarVector.ptp
~PolarVector.put
~PolarVector.ravel
~PolarVector.repeat
Expand All @@ -72,6 +69,7 @@
~PolarVector.sum
~PolarVector.swapaxes
~PolarVector.take
~PolarVector.to_device
~PolarVector.tobytes
~PolarVector.tofile
~PolarVector.tolist
Expand All @@ -94,13 +92,18 @@
~PolarVector.base
~PolarVector.ctypes
~PolarVector.data
~PolarVector.device
~PolarVector.dtype
~PolarVector.flags
~PolarVector.flat
~PolarVector.imag
~PolarVector.itemset
~PolarVector.itemsize
~PolarVector.mT
~PolarVector.nbytes
~PolarVector.ndim
~PolarVector.newbyteorder
~PolarVector.ptp
~PolarVector.real
~PolarVector.shape
~PolarVector.size
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,18 +44,15 @@
~PolarizerMatrix.getfield
~PolarizerMatrix.half_waveplate_retarder
~PolarizerMatrix.item
~PolarizerMatrix.itemset
~PolarizerMatrix.left_circular
~PolarizerMatrix.linear
~PolarizerMatrix.linear_retarder
~PolarizerMatrix.max
~PolarizerMatrix.mean
~PolarizerMatrix.min
~PolarizerMatrix.newbyteorder
~PolarizerMatrix.nonzero
~PolarizerMatrix.partition
~PolarizerMatrix.prod
~PolarizerMatrix.ptp
~PolarizerMatrix.put
~PolarizerMatrix.quarter_waveplate_retarder
~PolarizerMatrix.ravel
Expand All @@ -73,6 +70,7 @@
~PolarizerMatrix.sum
~PolarizerMatrix.swapaxes
~PolarizerMatrix.take
~PolarizerMatrix.to_device
~PolarizerMatrix.tobytes
~PolarizerMatrix.tofile
~PolarizerMatrix.tolist
Expand All @@ -94,13 +92,18 @@
~PolarizerMatrix.base
~PolarizerMatrix.ctypes
~PolarizerMatrix.data
~PolarizerMatrix.device
~PolarizerMatrix.dtype
~PolarizerMatrix.flags
~PolarizerMatrix.flat
~PolarizerMatrix.imag
~PolarizerMatrix.itemset
~PolarizerMatrix.itemsize
~PolarizerMatrix.mT
~PolarizerMatrix.nbytes
~PolarizerMatrix.ndim
~PolarizerMatrix.newbyteorder
~PolarizerMatrix.ptp
~PolarizerMatrix.real
~PolarizerMatrix.shape
~PolarizerMatrix.size
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,17 +46,14 @@
~StokesVector.getfield
~StokesVector.horizontal
~StokesVector.item
~StokesVector.itemset
~StokesVector.left_circular
~StokesVector.linear
~StokesVector.max
~StokesVector.mean
~StokesVector.min
~StokesVector.newbyteorder
~StokesVector.nonzero
~StokesVector.partition
~StokesVector.prod
~StokesVector.ptp
~StokesVector.put
~StokesVector.ravel
~StokesVector.repeat
Expand All @@ -73,6 +70,7 @@
~StokesVector.sum
~StokesVector.swapaxes
~StokesVector.take
~StokesVector.to_device
~StokesVector.to_jones
~StokesVector.tobytes
~StokesVector.tofile
Expand All @@ -96,13 +94,18 @@
~StokesVector.base
~StokesVector.ctypes
~StokesVector.data
~StokesVector.device
~StokesVector.dtype
~StokesVector.flags
~StokesVector.flat
~StokesVector.imag
~StokesVector.itemset
~StokesVector.itemsize
~StokesVector.mT
~StokesVector.nbytes
~StokesVector.ndim
~StokesVector.newbyteorder
~StokesVector.ptp
~StokesVector.real
~StokesVector.shape
~StokesVector.size
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion nenupy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
__copyright__ = "Copyright 2023, nenupy"
__credits__ = ["Alan Loh"]
__license__ = "MIT"
__version__ = "2.7.6"
__version__ = "2.7.7"
__maintainer__ = "Alan Loh"
__email__ = "alan.loh@obspm.fr"

Expand Down
6 changes: 3 additions & 3 deletions nenupy/astro/jones_mueller.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ def __new__(cls, input_array: np.ndarray):

@classmethod
def elliptical(cls, theta: float, delta: float):
r"""Ideal elliptical, producing elliptically polarized light with azimuth :math:`\psi` and ellipticity :math:`\omega` such that :math`\tan(2\psi)=\tan(2\theta)\cos(\delta)` and :math:`\sin(2\omega)=\sin(2\theta)\sin(\delta).
r"""Ideal elliptical, producing elliptically polarized light with azimuth :math:`\psi` and ellipticity :math:`\omega` such that :math:`\tan(2\psi)=\tan(2\theta)\cos(\delta)` and :math:`\sin(2\omega)=\sin(2\theta)\sin(\delta)`.
:param theta: in degrees.
:type theta: `float`
Expand Down Expand Up @@ -264,7 +264,7 @@ def __new__(cls, input_array: np.ndarray):

@classmethod
def elliptical(cls, theta: float, delta: float):
r"""Ideal elliptical, producing elliptically polarized light with azimuth :math:`\psi` and ellipticity :math:`\omega` such that :math`\tan(2\psi)=\tan(2\theta)\cos(\delta)` and :math:`\sin(2\omega)=\sin(2\theta)\sin(\delta).
r"""Ideal elliptical, producing elliptically polarized light with azimuth :math:`\psi` and ellipticity :math:`\omega` such that :math:`\tan(2\psi)=\tan(2\theta)\cos(\delta)` and :math:`\sin(2\omega)=\sin(2\theta)\sin(\delta)`.
:param theta: in degrees.
:type theta: `float`
Expand Down Expand Up @@ -315,7 +315,7 @@ def linear_retarder(cls, theta: float, delta: float):
def to_hermitian(self) -> np.ndarray:
r"""
.. math::
\mathbf{H} = \frac{1}{4} \sum_{i,j=0}^{3} M_{ij}( \mathbf{sigma_i} \kron \mathbf{\sigma}_j^{\star})
\mathbf{H} = \frac{1}{4} \sum_{i,j=0}^{3} M_{ij}( \mathbf{\sigma_i} \otimes \mathbf{\sigma}_j^{\star})
ref : https://arxiv.org/pdf/1906.11198.pdf eq. 6
"""
Expand Down
13 changes: 8 additions & 5 deletions nenupy/io/tf.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,10 +263,10 @@ def flatten_subband(cls):
"""

def wrapper_task(data, channels):
return utils.flatten_subband(data=data, channels=channels)
def wrapper_task(data, channels, smooth_frequency_profile):
return utils.flatten_subband(data=data, channels=channels, smooth_frequency_profile=smooth_frequency_profile)

return cls("Flatten subband", wrapper_task, ["channels"], repeatable=False)
return cls("Flatten subband", wrapper_task, ["channels", "smooth_frequency_profile"], repeatable=False)

@classmethod
def remove_channels(cls):
Expand Down Expand Up @@ -977,15 +977,15 @@ class Spectra:
"""

def __init__(self, filename: str, check_missing_data: bool = True):
def __init__(self, filename: str, check_missing_data: bool = False):
"""Generate an instance of :class:`~nenupy.io.tf.Spectra`.
Parameters
----------
filename : `str`
Path to the *UnDySPuTeD* file to read.
check_missing_data : `bool`, optional
Check for missing data, not checking may speed up the reading time, by default `True`
Check for missing data, not checking may speed up the reading time, by default `False`
Raises
------
Expand All @@ -1009,6 +1009,7 @@ def __init__(self, filename: str, check_missing_data: bool = True):
)

# Compute the main data block descriptors (time / frequency / beam)
log.info("Computing time-freequency axes...")
subband_width_hz = SUBBAND_WIDTH.to_value(u.Hz)
self._block_start_unix = (
data["TIMESTAMP"][~bad_block_mask]
Expand Down Expand Up @@ -1194,6 +1195,8 @@ def get(self, file_name: str = None, **pipeline_kwargs) -> SData:
Desired rebinning time resolution, can either be given as a :class:`~astropy.units.Quantity` object or a float (assumed to be in sec in that case). Note that the :meth:`~nenupy.io.tf.TFTask.time_rebin` task should be present in the planned pipeline (:attr:`~nenupy.io.tf.Spectra.pipeline`).
rebin_df : `float` or :class:`~astropy.units.Quantity`, default: ``None``
Desired rebinning frequency resolution, can either be given as a :class:`~astropy.units.Quantity` object or float (assumed to be in kHz in that case). Note that the :meth:`~nenupy.io.tf.TFTask.frequency_rebin` task should be present in the planned pipeline (:attr:`~nenupy.io.tf.Spectra.pipeline`).
smooth_frequency_profile : `bool`, default `False`
Keyword used if :meth:`~nenupy.io.tf.TFTask.flatten_subband` is in the pipeline: smooth the frequency profile, this option mau result in unexpected behavior if the subbands are not contiguous or the selected beamlets do not belong to the same digital beam.
remove_channels : `list` or :class:`~numpy.ndarray`, default: ``None``
List of subband channels to remove, e.g. `remove_channels=[0,1,-1]` would remove the first, second (low-freq) and last channels from each subband. Note that the :meth:`~nenupy.io.tf.TFTask.remove_channels` task should be present in the planned pipeline (:attr:`~nenupy.io.tf.Spectra.pipeline`).
dreambeam_skycoord : :class:`~astropy.coordinates.SkyCoord`, default: ``None``
Expand Down
Loading

0 comments on commit db5a10d

Please sign in to comment.