Skip to content

Commit

Permalink
Merge pull request #82 from GreenBankObservatory/evan-devel
Browse files Browse the repository at this point in the history
Baseline options, various documentation added
  • Loading branch information
vcatlett authored Oct 3, 2023
2 parents 9c78e4d + fd654f8 commit f91a2e0
Show file tree
Hide file tree
Showing 11 changed files with 244 additions and 69 deletions.
10 changes: 9 additions & 1 deletion docs/source/examples/positionswitch.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,15 @@ Position switched observations are those in which the telescope observes a targe

.. image:: ../_static/examples/gbt_ps_2.gif

While observing this is accomplished using the functions `OnOff` or `OffOn` in a scheduling block. For more details about these functions see Sections 6.4.2.2 and 6.4.2.3 of the |gbtog_link|.
While observing this is accomplished using the functions `OnOff` or `OffOn` in a scheduling block. For more details about these functions see Sections |gbtog_onoff_link| and |gbtog_offon_link| of the |gbtog_link|.

.. |gbtog_onoff_link| raw:: html

<a href="http://www.gb.nrao.edu/scienceDocs/GBTog.pdf#nameddest=subsubsection.6.4.2.2" target="_blank">6.4.2.2</a>

.. |gbtog_offon_link| raw:: html

<a href="http://www.gb.nrao.edu/scienceDocs/GBTog.pdf#nameddest=subsubsection.6.4.2.3" target="_blank">6.4.2.3</a>

.. |gbtog_link| raw:: html

Expand Down
47 changes: 44 additions & 3 deletions docs/source/for_developers/git_workflows.rst
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
*************
Git Workflows
Git Workflows
*************

Branches
========

The development team employs a GitFlow workflow with personal branching. This means that code in the `main` branch should always be in a releasable state. Developers should maintain their own development branches and commit changes to a `release-x.y.z` branch. When it's time to release, a dedicated team member will merge the `release-x.y.z` branch with the `main` branch and tag it accordingly.
The development team employs a GitFlow workflow with personal branching. This means that code in the `main` branch should always be in a releasable state. Developers should maintain their own development branches and commit changes to a `release-x.y.z` branch. When it's time to release, a dedicated team member will merge the `release-x.y.z` branch with the `main` branch and tag it accordingly.

.. mermaid::

Expand Down Expand Up @@ -40,4 +40,45 @@ The development team employs a GitFlow workflow with personal branching. This me
Releases
========

Release branches will be locked once work on the next release begins.
Release branches will be locked once work on the next release begins.

Setting up your own development branch
========

In the directory you want to work in, set up the repo:

`$ git clone [email protected]:GreenBankObservatory/dysh.git`

`$ cd dysh`

`$ git checkout [branch-name]`

with the [branch-name] replaced by the current release or other branch. Currently, this is "release-0.2.0". Then setup your own development branch with your first name followed by "-devel":

`$ git checkout [name-devel]`

Now make and activate a python virtual environment so your work doesn't impede or break other concurrent projects. Whenever you do some work, make sure you are in your own development branch. When you are ready to merge changes made by other developers into your own branch,

`$ git checkout release-0.2.0`

`$ git pull`

`$ git checkout [name-devel]`

`$ git merge release-0.2.0`

When you are ready to commit changes, review what's been changed with

`$ git status`

and then add the intended files using

`$ git add [path/to/changed/file]`

check `dysh/.gitignore` to make sure you are not adding ignored files (virtual environment data, `_build/`, etc.). Then commit and push with

`$ git commit -m "[this is my commit message]"`

`$ git push`

The first time you run this, it will give a command about setting the origin upstream. Simply copy and run that command. Users of GitHub Desktop can also achieve all of these above steps using the app interface. Next, go to the `dysh GitHub page <https://github.com/GreenBankObservatory/dysh/>`_ and submit a pull request.
1 change: 1 addition & 0 deletions src/dysh/fits/gbtfitsload.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ def summary(self, scans=None, verbose=False, bintable=0):
[compressed_df,ser.to_frame().T],
ignore_index=True)
compressed_df = compressed_df.astype(col_dtypes)
print(compressed_df.to_string(index=False))
return compressed_df

def velocity_convention(self,veldef,velframe):
Expand Down
16 changes: 13 additions & 3 deletions src/dysh/fits/tests/test_gbtfitsload.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,10 @@ def setup_method(self):
self._file_list = list(get_pkg_data_filenames("data/", pattern="*.fits"))

def test_load(self):

"""
Test loading 8 different sdfits files.
Check: number of pandas tables loaded is equal to the expected number.
"""
expected = {"TGBT21A_501_11.raw.vegas.fits": 4,
"TGBT21A_501_11_getps_scan_152_intnum_0_ifnum_0_plnum_0.fits": 1,
"TGBT21A_501_11_gettp_scan_152_intnum_0_ifnum_0_plnum_0_cal_state_0.fits": 1,
Expand All @@ -46,8 +49,12 @@ def test_load(self):

def test_getps_single_int(self):
"""
Compare gbtidl result to dysh for a getps spectrum from a single integration/pol/feed.
For the differenced spectrum (gbtidl - dysh) we check:
- median is 0.0
- all non-nan values are less than 5e-7
- index 3072 is nan (why?)
"""

gbtidl_file = get_pkg_data_filename("data/TGBT21A_501_11_getps_scan_152_intnum_0_ifnum_0_plnum_0.fits")
# We should probably use dysh to open the file...
hdu = fits.open(gbtidl_file)
Expand All @@ -67,8 +74,11 @@ def test_getps_single_int(self):

def test_gettp_single_int(self):
"""
Compare gbtidl result to dysh for a gettp spectrum from a single integration/pol/feed.
For the differenced spectrum (gbtidl - dysh) we check:
For the noise calibration diode on, off, and both:
- mean value is 0.0
"""

# Get the answer from GBTIDL.
gbtidl_file = get_pkg_data_filename("data/TGBT21A_501_11_gettp_scan_152_intnum_0_ifnum_0_plnum_0_cal_state_1.fits")
hdu = fits.open(gbtidl_file)
Expand Down
17 changes: 8 additions & 9 deletions src/dysh/plot/specplot.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class SpectrumPlot():
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
or reset using the `reset()` method.
or reset using the `reset()` method.
Parameters
----------
Expand All @@ -22,9 +22,9 @@ class SpectrumPlot():
Other Parameters
----------------
xaxis_unit : str or ~astrpy.unit.Unit
The units to use on the x-axis, e.g. "km/s" to plot velocity
yaxis_unit : str or ~astrpy.unit.Unit
xaxis_unit : str or ~astropy.unit.Unit
The units to use on the x-axis, e.g. "km/s" to plot velocity
yaxis_unit : str or ~astropy.unit.Unit
The units to use on the y-axis
xmin : float
Minimum x-axis value
Expand Down Expand Up @@ -72,12 +72,12 @@ def __init__(self,spectrum,**kwargs):
def axis(self):
"""The underlying :class:`~matplotlib.Axes` object"""
return self._axis

@property
def figure(self):
"""The underlying :class:`~matplotlib.Figure` object"""
return self._figure

@property
def spectrum(self):
"""The underlying `~spectra.spectrum.Spectrum`"""
Expand Down Expand Up @@ -110,7 +110,7 @@ def plot(self, **kwargs):
sa = np.arange(len(sa))
self._plot_kwargs['xlabel'] = "Channel"
else:
# convert the x axis to the requested
# convert the x axis to the requested
#print(f"EQUIV {equiv} doppler_rest {sa.doppler_rest} [{rfq}] convention {convention}")
#sa = s.spectral_axis.to( self._plot_kwargs["xaxis_unit"], equivalencies=equiv,doppler_rest=rfq, doppler_convention=convention)
sa = s.velocity.to( self._plot_kwargs["xaxis_unit"], equivalencies=s.equivalencies)
Expand Down Expand Up @@ -225,7 +225,7 @@ def _show_exclude(self,**kwargs):
kwargs_opts.update(kwargs)
#if kwargs_opts['loc'] == 'bottom':
# self._ax.axhline



def refresh(self):
Expand All @@ -239,4 +239,3 @@ def refresh(self):
def savefig(self,file,**kwargs):
"""Save the plot"""
self.figure.savefig(file,*kwargs)

36 changes: 36 additions & 0 deletions src/dysh/plot/tests/test_specplot.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@

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


from astropy.io import fits
from astropy.utils.data import (
get_pkg_data_filename,
get_pkg_data_filenames,
)

import dysh
from dysh.fits import gbtfitsload


dysh_root = pathlib.Path(dysh.__file__).parent.resolve()



class test_specplot():
"""
"""
def test_default_plotter():
"""
Just plot a default plot of a spectrum and visually inspect
"""
return 0


def test_complicated_plotter():
"""
Plot a more complicated spectrum and visually inspect
"""
return 0
Loading

0 comments on commit f91a2e0

Please sign in to comment.