Skip to content

Commit

Permalink
Merge pull request #4 from a-griffiths/v1.1.2
Browse files Browse the repository at this point in the history
v1.1.2
  • Loading branch information
a-griffiths authored Sep 20, 2018
2 parents 6cfe275 + fbbdffd commit 85e1467
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 22 deletions.
21 changes: 12 additions & 9 deletions AutoSpec
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
"""
AutoSpec: Automated Datacube Spectrum Extractor
@author: Alex Griffiths
v 1.1.0
05-09-2018
v 1.1.2
20-09-2018
"""
# Import dependencies.
from __future__ import absolute_import, division, print_function
Expand Down Expand Up @@ -59,16 +59,16 @@ def create_source(ID, ra, dec, size, ref):
if ref == '':
ext_mode = 'IMG'
refspec = 'MUSE_WHITE'
elif ref not in imgs.keys():
print('Reference not in images or apertures, using white light.')
elif ref.replace('.', '').isdigit() is False:
ext_mode = 'IMG'
refspec = 'MUSE_WHITE'
refspec = ref
elif ref.replace('.', '').isdigit() is True:
ext_mode = 'APER'
refspec = 'MUSE_APER_%.1f' % float(ref)
elif ref.replace('.', '').isdigit() is False:
elif ref not in imgs.keys():
print('Reference not in images or apertures, using white light.')
ext_mode = 'IMG'
refspec = ref
refspec = 'MUSE_WHITE'

# This creates the source object (see MPDAF for more details).
s = Source.from_data(ID=ID, ra=ra, dec=dec, extras=extra,
Expand Down Expand Up @@ -108,10 +108,11 @@ def create_source(ID, ra, dec, size, ref):

# Extract all spectra set by user.
tags = [i for i in s.images.keys() if 'SEG_' not in i and 'MASK_' not in i]
aps = params.APER if isinstance(params.APER, tuple) else [params.APER]

s.extract_spectra(s.cubes['MUSE'], obj_mask=mask,
sky_mask='MASK_SKY', skysub=params.SKY_SUB,
tags_to_try=tags, apertures=params.APER)
tags_to_try=tags, apertures=aps)

# Set up naming convention based on if the user has sky-subtraction set.
if params.SKY_SUB is True:
Expand Down Expand Up @@ -186,8 +187,10 @@ def create_masks(src):
src.add_seg_images(del_sex=False)
seg = [i for i in src.images.keys() if 'SEG_' in i]
# Do not use the white light image not set.
if params.USE_WHITE is False:
if params.USE_IMGS is False:
seg.remove('SEG_MUSE_WHITE')
for key in imgs:
seg.remove('SEG_'+key)
src.find_sky_mask(seg)
src.find_union_mask(seg)
# Check if any maps are empty before creating intersection mask.
Expand Down
4 changes: 2 additions & 2 deletions catalog_format.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Example catalog file for AutoSpec v 1.1.0
# DATE: 05-09-2018
# Example catalog file for AutoSpec v 1.1.2
# DATE: 20-09-2018

# Parameter mode catalog format [id ra dec].
#
Expand Down
6 changes: 3 additions & 3 deletions param_format.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Default configuration file for AutoSpec v 1.1.0
# DATE: 05-09-2018
# Default configuration file for AutoSpec v 1.1.2
# DATE: 20-09-2018

# ----------- Operating Mode -------------------------------------------------------------------------------------------------------------------------------------------------------------

Expand All @@ -25,7 +25,7 @@

# ----------- Object Masks ----------------------------------------------------------------------------------------------------------------------------------------------------------------

USE_WHITE = True # if AutoSpec should also use the MUSE_WHITE segmentation map to create masks (True or False).
USE_IMGS = True # if AutoSpec should also use the segmentation maps created from the images in IMG parameter to create final masks (True or False).
OBJ_MASK = 'INTER' # object mask from union (UNION) or intersection (INTER) of segmentation maps (string).
SEG = '' # name of additional segmentation maps files to be used (string or comma seperated list of strings).

Expand Down
4 changes: 2 additions & 2 deletions test/catalog.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Example catalog file for AutoSpec v 1.1.0
# DATE: 05-09-2018
# Example catalog file for AutoSpec v 1.1.2
# DATE: 20-09-2018

# Parameter mode catalog format [id ra dec].
#
Expand Down
12 changes: 6 additions & 6 deletions test/param.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Default configuration file for AutoSpec v 1.1.0
# DATE: 05-09-2018
# Default configuration file for AutoSpec v 1.1.2
# DATE: 20-09-2018

# ----------- Operating Mode -------------------------------------------------------------------------------------------------------------------------------------------------------------

Expand All @@ -20,14 +20,14 @@

# ----------- Spectral Extractions --------------------------------------------------------------------------------------------------------------------------------------------------------

APER = 1.0, 2.0 # aperture sizes (in arcseconds) for spectrum extraction (float or array or floats).
IMG = 'g-band.fits', 'r-band.fits' # name of additional image files for weighted spectra and segmentation extractions (string or comma seperated list of strings), '' if none.
APER = 2.0 # aperture sizes (in arcseconds) for spectrum extraction (float or array or floats).
IMG = 'g-band.fits','r-band.fits' # name of additional image files for weighted spectra and segmentation extractions (string or comma seperated list of strings), '' if none.

# ----------- Object Masks ----------------------------------------------------------------------------------------------------------------------------------------------------------------

USE_WHITE = True # if AutoSpec should also use the MUSE_WHITE segmentation map to create masks (True or False).
USE_IMGS = True # if AutoSpec should also use the segmentation maps created from the images in IMG parameter to create final masks (True or False).
OBJ_MASK = 'INTER' # object mask from union (UNION) or intersection (INTER) of segmentation maps (string).
SEG = 'g-seg.fits', 'r-seg.fits' # name of additional segmentation maps files to be used (string or comma seperated list of strings).
SEG = 'g-seg.fits' # name of additional segmentation maps files to be used (string or comma seperated list of strings).

# ----------- Output Formatting -----------------------------------------------------------------------------------------------------------------------------------------------------------

Expand Down

0 comments on commit 85e1467

Please sign in to comment.