Skip to content

Commit

Permalink
Merge pull request #112 from bwgref/v0.6dev
Browse files Browse the repository at this point in the history
v0.6 release PR
  • Loading branch information
bwgref authored Oct 27, 2023
2 parents 013771b + bd65aa7 commit 2608f1c
Show file tree
Hide file tree
Showing 10 changed files with 187 additions and 145 deletions.
18 changes: 18 additions & 0 deletions docs/changelog.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
===========
Change Log
===========

v0.6 (2023-10-27)
---------------

* Now requires astropy regions >0.7
* Lots of bug fixes
* Updated validate_det1_region for regions metadata change
* Added grouping keywords to spectral products
* Updates wrappers for stray light to add flexibility
* Added nustar_gen.diagnostic which has tools for determining if there is excess solar background and downloading GOES X-ray plots.
* Added additional example notebooks

Contributors to this update:
- Brian Grefenstette
- Yash Bhargava
1 change: 1 addition & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ nustar_gen documentation
:maxdepth: 1

readme
changelog
info
diagnostic
utils
Expand Down
2 changes: 1 addition & 1 deletion docs/io.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.. module:: nustar_gen

IO Functions
I/O Functions
==================================

.. autofunction:: nustar_gen.io.find_be_arf
Expand Down
1 change: 0 additions & 1 deletion docs/utils.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,3 @@ Utility Scripts
.. autofunction:: nustar_gen.utils.chan_to_energy
.. autofunction:: nustar_gen.utils.make_usr_gti
.. autofunction:: nustar_gen.utils.append_fits_entry

5 changes: 3 additions & 2 deletions nustar_gen/diagnostic.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,7 @@ def goes_lightcurve(obs, show_sun=False, show_sky=False, show_impact=True):
ax.add_patch(rect)

plt.show()
return

def compare_sun_spec(obs,mod='A',src_rad = 2*u.arcmin,
en_range = (3, 20), en_bins = 34, ratio = False):
Expand All @@ -221,7 +222,7 @@ def compare_sun_spec(obs,mod='A',src_rad = 2*u.arcmin,
Energy range to use. Default is (3, 20).
en_bins : int
Number of bins to use for histogram (default is 34)
ratio : bool
ratio : bool
Whether to plot the spectra or their ratio. Default is False.
Returns
Expand Down Expand Up @@ -313,7 +314,7 @@ def compare_sun_spec(obs,mod='A',src_rad = 2*u.arcmin,
ax.axhline(1.0, color = 'green')
plt.show()


return



7 changes: 4 additions & 3 deletions nustar_gen/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ def find_be_arf():
Returns
-------
Full path to the Be window file in the CALDB
be_arf_file : str
Full path to the Be window file in the CALDB
Examples
--------
Expand Down Expand Up @@ -48,8 +49,8 @@ def find_arf_template():
Returns
-------
Full path to the Be window file, which should be included when this repo is
checked out
arf_file : str
Full path to the Be window file, which should be included when this repo is checked out
Examples
--------
Expand Down
19 changes: 14 additions & 5 deletions nustar_gen/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,6 @@ def make_straylight_arf(det1im, regfile, filt_file, mod, obs):
'''
Produces an ARF for a given observation. Currently uses counts-weighting to
determine the contribution of the detabs parameters for each detector.
SHOULD PROBABLY BE MOVED TO WRAPPERS OR SOMETHING?
Parameters
----------
Expand Down Expand Up @@ -345,6 +344,18 @@ def validate_det1_region(regfile):
"""
Code for making sure that region files that you're trying to use on the DET1
analysis code are in "image" coordinates
Parameters
----------
regfile : str
Full path to a ds9 region file
Returns
-------
None
"""
err=-1
import regions
Expand All @@ -368,10 +379,11 @@ def validate_det1_region(regfile):

# Check to make sure tha the first region in the file is an "include" region
for ri in reg:
assert ri.meta['include'] is True, \
assert ri.meta['include'] == 1, \
f'\n {regfile} has an exclusion region first! \n Put the source region first instead!'
break

return

def straylight_background(det1im_file='None', sky2det_file='None',
reg_file = 'None', det1_expo_file = 'None',
Expand All @@ -398,9 +410,6 @@ def straylight_background(det1im_file='None', sky2det_file='None',
det1_expo_file : str
Path to the DET1 effective area file. Should be the DET1 output of
wrappers.make_exposure_map
Optional Parameters
-------------------
diag : bool
Show diagnostic information and make some plots showing what is happening.
Expand Down
2 changes: 1 addition & 1 deletion nustar_gen/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
from setuptools_scm import get_version
version = get_version(root='..', relative_to=__file__)
except Exception:
version = '0.6.dev9+g80e934a.d20220720'
version = '0.6.dev34+g013771b.d20231025'
Loading

0 comments on commit 2608f1c

Please sign in to comment.