Skip to content

Commit db340ee

Browse files
committed
Merge branch 'dev'
2 parents cbb69fa + c4ed089 commit db340ee

14 files changed

Lines changed: 97 additions & 105 deletions

File tree

README.md

Lines changed: 33 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -166,21 +166,32 @@ If you make use of HostPhot, please cite the following [paper](https://joss.theo
166166
}
167167
```
168168

169-
## What's new!
169+
## What's new
170+
171+
v3.1.0
172+
173+
* Using DES DR2 instead of DR1
174+
* Downloading images, for some surveys, trying to avoid timeout errors.
175+
* Adapting global aperture even if the survey is the same as the reference (mainly to avoid issues with JWST).
176+
* Fixing/adding features from different issues, mainly for HST/JWST ([#8](https://github.com/temuller/hostphot/issues/8), [#9](https://github.com/temuller/hostphot/issues/9), [#10](https://github.com/temuller/hostphot/issues/10), [#11](https://github.com/temuller/hostphot/issues/11) - thanks Lisa!).
177+
170178
v3.0.0
171-
* Major internal restructuring of the code
172-
* Convert the cutouts into a module with each survey as a different submodule
173-
* Storage of input parameters (with timestamps)
174-
* Storage of output parameters in a more friendly format
175-
* Restructuring of output files
176-
* Fix the VISTA SCIENCE ARCHIVE url for downloading VISTA images
179+
180+
* Major internal restructuring of the code:
181+
* Convert the cutouts into a module with each survey as a different submodule
182+
* Storage of input parameters (with timestamps)
183+
* Storage of output parameters in a more friendly format
184+
* Restructuring of output files
185+
* Fix the VISTA SCIENCE ARCHIVE url for downloading VISTA images.
177186
* Fix issue with VISTA image size when downloading cuouts
178187
* The download of VISTA images now automatically chooses the survey with overlap for the given coordinates, prioritising the survey with deeper coverage.
179188
* The user experience is kept approximately consistent with previous versions, but there are some changes
180189
* Download of HST images is now working!
181190
* Adding download of JWST images!
191+
182192
___
183193
v2.10.0
194+
184195
* Adding JWST! (few NIRCam filters for now - thanks to Lisa Kelsey for this addition)
185196
* SkyMapper upgrade from DR2 to DR4 (note that there is still a problem with the photometric calibration of extended sources)
186197
* Fix HST functions, which includes working with Drizzlepac images
@@ -189,11 +200,13 @@ v2.10.0
189200
* Close some fits images that were previously kept opened
190201

191202
v2.9.0
203+
192204
* Fixing issue when applying/propagating common-mask parameters (e.g. from a coadd) to other images
193205
* Updated error propagation for Legacy Survey with inverse-variance maps (using it as a weight mask now)
194206
* Bumping up the DR version of VIKING and VIDEO for VISTA
195207

196208
v2.8.0
209+
197210
* Fix SED plotting with negative or too large values/errors, and improve plotting aesthetics
198211
* Fix problem downloading some 2MASS images giving internal server error (no image overlap)
199212
* Adding UKIDSS, SPLUS and SkyMapper surveys. WARNINGS: SkyMapper photometry (DR2) is not very accurate with extended sources!
@@ -208,31 +221,38 @@ v2.8.0
208221
* Kron radius is no longer "optimized", just the scale, which doesn't have any effect in practice for the user
209222

210223
v2.7.1
224+
211225
* Adding SED plotting
212-
* Fixed plotting angle of masked object
226+
* Fixed plotting angle of masked object
213227

214228
v2.7.0
229+
215230
* MAJOR BUG: Convertion factor between different pixel scales fixed (it was previously inverted). This affects the common aperture photometry between different surveys!
216231
* Moving font family to `_constant.py` file
217232

218233
v2.6.2
234+
219235
* Prettier plots (now using `aplpy`), but also more informative!
220-
* Scale of the apertures for the masks is now a parameter (`r`)
236+
* Scale of the apertures for the masks is now a parameter (`r`)
221237
* Raise exception is now `True` by default when calculating photometry
222238

223239
v2.6.1
240+
224241
* 2MASS cutouts improved (picking largest image)
225242

226243
v2.6.0:
244+
227245
* HST (WFC3 only - pseudo-trial) included
228246
* 2MASS cutouts fixed (it now downloads the image closest to the given coordinates)
229247

230248
v2.5.1:
249+
231250
* Using sfdmap2 instead of sfdmap to avoid issues with numpy version (requires Python>=3.9)
232251

233252
v2.5.0:
253+
234254
* Systematic error floor added to PS1 photometry
235-
* Added missing uncertainties in the error budget of DES (~5 mmag)
255+
* Added missing uncertainties in the error budget of DES (~5 mmag)
236256
* Flux/counts have been added to output photometry
237257
* GALEX now downloads images with largest exposure time by default
238258
* Fixed image realignment/orientation between different surveys when using common apertures (for masking and global photometry)
@@ -244,15 +264,16 @@ v2.5.0:
244264
* Other minor bugs fixed
245265

246266
v2.4.0:
267+
247268
* Fixed and improved GALEX cutouts
248269
* Better galaxy identification
249270
* Better output plots for masked images
250271
* Option to return NaN or raise an exception when getting photometry
251272

252273
v2.3.2:
253-
* Improved download of GALEX images (download even if they seem to be just background noise)
254274

275+
* Improved download of GALEX images (download even if they seem to be just background noise)
255276

256277
## Acknowledgements
257278

258-
I thank Yuchen LIU for helping me adding Spitzer as part of AstroHackWeek 2022.
279+
I thank Yuchen LIU for helping me adding Spitzer as part of AstroHackWeek 2022. I also thank Lisa Kelsay for helping add HST and JWST.

src/hostphot/_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
# -*- coding: utf-8 -*-
22

3-
__version__ = "3.0.0rc1"
3+
__version__ = "3.1.0"

src/hostphot/cutouts/des.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
from astropy.io import fits
77
from astropy import units as u
88

9+
from hostphot.utils import open_fits_from_url
910
from hostphot.surveys_utils import get_survey_filters, check_filters_validity
1011

1112

@@ -30,7 +31,7 @@ def get_DES_urls(ra: float, dec: float, fov: float, filters: str="grizY") -> tup
3031
filters = get_survey_filters("DES")
3132
check_filters_validity(filters, "DES")
3233
# get field-of-view table
33-
des_access_url = "https://datalab.noirlab.edu/sia/des_dr1"
34+
des_access_url = "https://datalab.noirlab.edu/sia/des_dr2"
3435
svc = sia.SIAService(des_access_url)
3536
imgs_table = svc.search(
3637
(ra, dec), (fov / np.cos(dec * np.pi / 180), fov), verbosity=2
@@ -101,12 +102,15 @@ def get_DES_images(ra: float, dec: float, size: float | u.Quantity = 3, filters:
101102
hdu_list = []
102103
for url, url_w in zip(url_list, url_w_list):
103104
# combine image+weights on a single fits file
104-
image_hdu = fits.open(url)
105+
#image_hdu = fits.open(url, timeout=120)
106+
image_hdu = open_fits_from_url(url)
105107
hdu = fits.PrimaryHDU(image_hdu[0].data, header=image_hdu[0].header)
106108
if url_w is None:
107109
hdu_sublist = fits.HDUList([hdu])
108110
else:
109-
weight_hdu = fits.open(url_w)
111+
print(url_w)
112+
#weight_hdu = fits.open(url_w, timeout=120)
113+
weight_hdu = open_fits_from_url(url_w)
110114
hdu_err = fits.ImageHDU(
111115
weight_hdu[0].data, header=weight_hdu[0].header
112116
)

src/hostphot/cutouts/galex.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
from astropy.coordinates import SkyCoord
99
from astroquery.mast import Observations
1010

11+
from hostphot.utils import open_fits_from_url
1112
from hostphot.surveys_utils import get_survey_filters, check_filters_validity, survey_pixel_scale
1213

1314
import warnings
@@ -92,7 +93,7 @@ def get_GALEX_images(ra: float, dec: float, size: float | u.Quantity = 3,
9293
hdu_list = []
9394
for file in files:
9495
try:
95-
hdu = fits.open(file)
96+
hdu = open_fits_from_url(file)
9697
hdu_list.append(hdu)
9798
except:
9899
pass

src/hostphot/cutouts/legacysurvey.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
from astropy.io import fits
33
from typing import Optional
44

5+
from hostphot.utils import open_fits_from_url
56
from hostphot.surveys_utils import get_survey_filters, check_filters_validity, survey_pixel_scale
67

78
def get_LegacySurvey_images(ra: float, dec: float, size: float | u.Quantity = 3,
@@ -42,7 +43,7 @@ def get_LegacySurvey_images(ra: float, dec: float, size: float | u.Quantity = 3,
4243
params = f"ra={ra}&dec={dec}&layer=ls-{version}&pixscale={pixel_scale}&bands={filters}&size={size_pixels}&invvar"
4344
url = base_url + params
4445

45-
master_hdu = fits.open(url)
46+
master_hdu = open_fits_from_url(url)
4647
master_header = master_hdu[0].header
4748
master_header_invvar = master_hdu[1].header
4849

src/hostphot/cutouts/panstarrs.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
from astropy import units as u
66
from astropy.table import Table
77

8+
from hostphot.utils import open_fits_from_url
89
from hostphot.surveys_utils import get_survey_filters, check_filters_validity, survey_pixel_scale
910

1011
def query_ps1(ra: float, dec: float, size: float | u.Quantity = 3, filters: Optional[str] = None) -> Table:
@@ -111,6 +112,6 @@ def get_PanSTARRS_images(ra: float, dec: float, size: float | u.Quantity = 3, fi
111112
# download FITS images
112113
hdu_list = []
113114
for url, filt in zip(fits_url, filters):
114-
hdu = fits.open(url)
115+
hdu = open_fits_from_url(url)
115116
hdu_list.append(hdu)
116117
return hdu_list

src/hostphot/cutouts/skymapper.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
from astropy.io import fits
66

77
from pyvo.dal import sia
8+
from hostphot.utils import open_fits_from_url
89
from hostphot.surveys_utils import get_survey_filters, check_filters_validity
910

1011
def get_SkyMapper_urls(ra: float, dec: float, fov: float | u.Quantity = 3,
@@ -86,7 +87,7 @@ def get_SkyMapper_images(ra: float, dec: float, size: float | u.Quantity = 3,
8687
if url is None:
8788
hdu_list.append(None)
8889
else:
89-
hdu = fits.open(url)
90+
hdu = open_fits_from_url(url)
9091
# add zeropoint
9192
hdu[0].header['MAGZP'] = hdu[0].header['ZPAPPROX']
9293
hdu_list.append(hdu)

src/hostphot/cutouts/spitzer.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import astropy.units as u
55
from astropy.io import fits
66

7+
from hostphot.utils import open_fits_from_url
78
from hostphot.surveys_utils import get_survey_filters, check_filters_validity, survey_pixel_scale
89

910
def get_Spitzer_images(ra: float, dec: float, size: float | u.Quantity = 3,
@@ -80,7 +81,7 @@ def get_Spitzer_images(ra: float, dec: float, size: float | u.Quantity = 3,
8081
hdu_list = []
8182
for filt, file in files_dict.items():
8283
if file is not None:
83-
hdu = fits.open(file)
84+
hdu = open_fits_from_url(file)
8485
hdu[0].header["MAGZP"] = hdu[0].header["ZPAB"]
8586
hdu_list.append(hdu)
8687
else:

src/hostphot/cutouts/splus.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
import hostphot
1111
hostphot_path = Path(hostphot.__path__[0])
12+
from hostphot.utils import open_fits_from_url
1213
from hostphot.surveys_utils import get_survey_filters, check_filters_validity
1314

1415
def get_SPLUS_urls(ra: float, dec: float, fov: float | u.Quantity = 3,
@@ -88,7 +89,7 @@ def get_SPLUS_images(ra: float, dec: float, size: float | u.Quantity = 3,
8889
if url is None:
8990
hdu_list.append(None)
9091
else:
91-
hdu = fits.open(url)
92+
hdu = open_fits_from_url(url)
9293
# add zeropoint
9394
# file from https://splus.cloud/documentation/dr2_3
9495
zps_file = hostphot_path.joinpath('filters', 'SPLUS', 'iDR3_zps.cat')

src/hostphot/cutouts/twomass.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
from astropy.nddata import Cutout2D
1010
from astropy.coordinates import SkyCoord
1111

12+
from hostphot.utils import open_fits_from_url
1213
from hostphot.surveys_utils import get_survey_filters, check_filters_validity, survey_pixel_scale
1314

1415

@@ -63,7 +64,7 @@ def get_2MASS_images(
6364
for line in response.content.decode("utf-8").split("<TD><![CDATA["):
6465
if re.match(f"https://irsa.*{filter.lower()}i.*fits", line.split("]]>")[0]):
6566
fitsurl = line.split("]]")[0]
66-
fits_image = fits.open(fitsurl, cache=None)
67+
fits_image = open_fits_from_url(fitsurl)
6768
wcs = WCS(fits_image[0].header)
6869
if coords.contained_by(wcs):
6970
break

0 commit comments

Comments
 (0)