Skip to content

Commit

Permalink
Merge pull request #119 from GreenBankObservatory/fix_py3.12_syntax_w…
Browse files Browse the repository at this point in the history
…arnings

Fix invalid escape sequences in docstrings
  • Loading branch information
mpound authored Nov 21, 2023
2 parents 3dd109c + 9c29e8d commit e84c06c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 18 deletions.
15 changes: 7 additions & 8 deletions src/dysh/plot/specplot.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
"""Plot a spectrum using matplotlib"""
import copy

import astropy.units as u
import matplotlib.pyplot as plt
import numpy as np


class SpectrumPlot:
"""
r"""
The SpectrumPlot class is for simple plotting of a ~spectrum.Spectrum
using matplotlib functions. Plots attributes are modified using keywords
(\*\*kwargs) described below SpectrumPlot will attempt to make smart default
(**kwargs) described below SpectrumPlot will attempt to make smart default
choices for the plot if no additional keywords are given.
The attributes are "sticky" meaning that an attribute set via
instantiation or by the `plot()` method will stay set until changed
Expand All @@ -20,7 +19,7 @@ class SpectrumPlot:
----------
spectrum : `~spectra.spectrum.Spectrum`
The spectrum to plot
\**kwargs : dict
**kwargs : dict
Plot attribute keyword arguments, see below.
Other Parameters
Expand Down Expand Up @@ -88,12 +87,12 @@ def spectrum(self):
return self._spectrum

def plot(self, **kwargs):
"""
r"""
Plot the spectrum.
Parameters
----------
\**kwargs : various
**kwargs : various
keyword=value arguments (need to describe these in a central place)
"""
# xtype = 'velocity, 'frequency', 'wavelength'
Expand Down Expand Up @@ -164,7 +163,7 @@ def reset(self):
}

def _set_labels(self, title=None, xlabel=None, ylabel=None, **kwargs):
"""Set x and y labels according to spectral units
r"""Set x and y labels according to spectral units
Parameters
----------
Expand All @@ -174,7 +173,7 @@ def _set_labels(self, title=None, xlabel=None, ylabel=None, **kwargs):
x-axis label
ylabel : str
x-axis label
\*\*kwargs : various
**kwargs : various
other keyword=value arguments
"""
if title is not None:
Expand Down
18 changes: 8 additions & 10 deletions src/dysh/spectra/scan.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ def timeaverage(self, weights="tsys"):
return self._timeaveraged

def polaverage(self, weights="tsys"):
"""Average all polarizations in all scans in this ScanBlock
r"""Average all polarizations in all scans in this ScanBlock
Parameters
----------
Expand All @@ -172,7 +172,7 @@ def polaverage(self, weights="tsys"):
return self._polaveraged

def finalspectrum(self, weights="tsys"):
"""Average all times and polarizations in all scans this ScanBlock
r"""Average all times and polarizations in all scans this ScanBlock
Parameters
----------
Expand Down Expand Up @@ -362,7 +362,7 @@ def total_power(self, i):
meta["TSYS"] = self._tsys[i]
meta["EXPOSURE"] = self.exposure[i]
naxis1 = len(self._data[i])
ctype1 = meta["CTYPE1"]
meta["CTYPE1"]
ctype2 = meta["CTYPE2"]
ctype3 = meta["CTYPE3"]
crval1 = meta["CRVAL1"]
Expand Down Expand Up @@ -536,7 +536,7 @@ def calibrated(self, i):
meta["TSYS"] = self._tsys[i]
meta["EXPOSURE"] = self._exposure[i]
naxis1 = len(self._calibrated[i])
ctype1 = meta["CTYPE1"]
meta["CTYPE1"]
ctype2 = meta["CTYPE2"]
ctype3 = meta["CTYPE3"]
crval1 = meta["CRVAL1"]
Expand Down Expand Up @@ -694,7 +694,7 @@ def timeaverage(self, weights="tsys"):


class SubBeamNodScan(ScanMixin): # SBNodScan?
"""
r"""
Parameters
----------
sigtp: list of ~spectra.scan.TPScan
Expand Down Expand Up @@ -758,8 +758,6 @@ def calibrate(self, **kwargs):
self._calibrated[i] = ta

elif self._method == "scan":
tpon = self._sigtp
tpoff = self._reftp
# Process the whole scan as a single block.
# This is less accurate, but might be needed if
# the scan was aborted and there are not enough
Expand All @@ -784,7 +782,7 @@ def calibrated(self, i):
meta = deepcopy(self._sigtp[i].timeaverage().meta)
meta["TSYS"] = self._tsys[i]
naxis1 = len(self._calibrated[i])
ctype1 = meta["CTYPE1"]
meta["CTYPE1"]
ctype2 = meta["CTYPE2"]
ctype3 = meta["CTYPE3"]
crval1 = meta["CRVAL1"]
Expand Down Expand Up @@ -883,8 +881,8 @@ def timeaverage(self, weights="tsys"):
ta_avg[:] += data[i] * self.tsys[i] ** -2.0
wt1 = self.tsys**-2.0
wt2 = tsys_weight(self.exposure, self.delta_freq, self.tsys)
tavg2 = average(data, 0, wt1)
tsysavg2 = average(self.tsys, 0, wt2)
average(data, 0, wt1)
average(self.tsys, 0, wt2)
ta_avg /= wt_avg
tsys_avg /= tsys_wt
self._timeaveraged._data = ta_avg
Expand Down

0 comments on commit e84c06c

Please sign in to comment.