Skip to content

Commit

Permalink
Require astropy >= 2
Browse files Browse the repository at this point in the history
  • Loading branch information
sergiopasra committed May 3, 2018
1 parent 96045bd commit 07b6070
Show file tree
Hide file tree
Showing 13 changed files with 26 additions and 34 deletions.
10 changes: 1 addition & 9 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,10 @@ sudo: false

matrix:
include:
- python: "2.7"
env: DEPS="numpy scipy astropy=1.1 enum34"
- python: "2.7"
env: DEPS="numpy scipy astropy=1.3 enum34"
- python: "2.7"
env: DEPS="numpy scipy astropy=2.0 enum34"
- python: "3.5"
env: DEPS="numpy scipy astropy=2.0" COVERAGE=true
- python: "3.5"
env: DEPS="numpy scipy astropy=3.0"
- python: "3.6"
env: DEPS="numpy scipy astropy=2.0"
env: DEPS="numpy scipy astropy=3.0" COVERAGE=true
- python: "3.6"
env: DEPS="numpy scipy astropy=3.0"

Expand Down
2 changes: 1 addition & 1 deletion megaradrp/processing/combine.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ def main(args=None):
with contextlib.nested(*[fits.open(fname) for fname in args.image]) as hduls:
result = combination_hdul(hduls, method=method, errors=errors, prolog=None)

result.writeto(args.output, clobber=True)
result.writeto(args.output, overwrite=True)
# with contextlib.ExitStack() as stack:
# hduls = [stack.enter_context(fits.open(fname)) for fname in args.image]
# combination_hdul(hduls, method=combine.mean, errors=False, prolog=None)
Expand Down
2 changes: 1 addition & 1 deletion megaradrp/processing/tests/test_aperture.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
# eq = 0.8 * np.ones((4112, 4096))
# temporary_path = mkdtemp()
#
# fits.writeto('%s/eq.fits' % temporary_path, eq, clobber=True)
# fits.writeto('%s/eq.fits' % temporary_path, eq, overwrite=True)
#
# image =file(temporary_path + '/eq.fits')
# obj = ApertureExtractor(None)
Expand Down
8 changes: 4 additions & 4 deletions megaradrp/processing/tests/test_processing.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def test_trim_and_o(direction):
'bng': [1,1]
}
fs = generate_bias_file()
fits.writeto('%s/flat.fits' % (temporary_path), fs, clobber=True)
fits.writeto('%s/flat.fits' % (temporary_path), fs, overwrite=True)
trimOut(
'%s/flat.fits' % (temporary_path),
detconf,
Expand All @@ -61,7 +61,7 @@ def test_trim_and_o(direction):
def test_trim_and_o_fail():
temporary_path = mkdtemp()
fs = generate_bias_file()
fits.writeto('%s/flat.fits' % (temporary_path), fs, clobber=True)
fits.writeto('%s/flat.fits' % (temporary_path), fs, overwrite=True)

direction = 'fails'
detconf = {
Expand All @@ -83,7 +83,7 @@ def test_trim_and_o_fail():
def test_trim_and_o_fail2():
temporary_path = mkdtemp()
fs = generate_bias_file()
fits.writeto('%s/flat.fits' % (temporary_path), fs, clobber=True)
fits.writeto('%s/flat.fits' % (temporary_path), fs, overwrite=True)

bins = 'fail'
detconf = {
Expand Down Expand Up @@ -112,7 +112,7 @@ def test_apextract_weights():
rss = apextract_weights(data, tarfile.open(file_name, 'r'))
hdu_rss = fits.PrimaryHDU(rss)
final = fits.HDUList([hdu_rss])
final.writeto('rss.fits', clobber=True)
final.writeto('rss.fits', overwrite=True)
assert True


Expand Down
4 changes: 2 additions & 2 deletions megaradrp/processing/trimover.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def trimOut(img, detconf, direction='normal', out='trimmed.fits'):
if issubclass(str, type(img)):
with fits.open(img) as hdul:
hdu = trim_and_o_array(hdul[0].data, detconf, direction=direction)
fits.writeto(out, hdu, clobber=True)
fits.writeto(out, hdu, overwrite=True)

elif isinstance(img, fits.PrimaryHDU):
finaldata = trim_and_o_array(img.data, detconf, direction=direction)
Expand Down Expand Up @@ -225,7 +225,7 @@ def test_image(self):
data[self.ocol2] += 500
data[self.trim2] += 5000

fits.writeto('eq_estimado.fits', data, clobber=True)
fits.writeto('eq_estimado.fits', data, overwrite=True)

def run(self, img):
imgid = self.get_imgid(img)
Expand Down
10 changes: 5 additions & 5 deletions megaradrp/recipes/calibration/tests/test_bpm.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def test_bpm():
config_uuid = '4fd05b24-2ed9-457b-b563-a3c618bb1d4c'
temporary_path = mkdtemp()

fits.writeto('%s/eq.fits' % temporary_path, qe, clobber=True)
fits.writeto('%s/eq.fits' % temporary_path, qe, overwrite=True)

readpars1 = ReadParams(gain=gain, ron=ron, bias=bias)
readpars2 = ReadParams(gain=gain, ron=ron, bias=bias)
Expand All @@ -62,15 +62,15 @@ def test_bpm():
for aux in range(len(fs)):
fits.writeto('%s/flat_%s.fits' % (temporary_path, aux), fs[aux],
header=header,
clobber=True)
overwrite=True)
fits.writeto('%s/flat_%s.fits' % (temporary_path, aux + number), fs2[aux],
header=header,
clobber=True)
overwrite=True)

result = generate_bias(detector, number, temporary_path)
result.master_bias.frame.writeto(
'%s/master_bias_data0.fits' % temporary_path,
clobber=True
overwrite=True
)

ob = ObservationResult()
Expand All @@ -87,7 +87,7 @@ def test_bpm():
ri = recipe.create_input(obresult=ob, master_bias=DataFrame(
filename=open(temporary_path + '/master_bias_data0.fits').name))
aux = recipe.run(ri)
aux.master_bpm.frame.writeto('%s/master_bpm.fits' % temporary_path, clobber=True)
aux.master_bpm.frame.writeto('%s/master_bpm.fits' % temporary_path, overwrite=True)
shutil.rmtree(temporary_path)


Expand Down
8 changes: 4 additions & 4 deletions megaradrp/recipes/calibration/tests/test_bpm_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def generate_bias(detector, number, temporary_path):
for aux in range(len(fs)):
fits.writeto('%s/bias_%s.fits' % (temporary_path, aux), fs[aux],
header=header,
clobber=True)
overwrite=True)

fs = ["%s/bias_%s.fits" % (temporary_path, i) for i in range(number)]

Expand Down Expand Up @@ -76,12 +76,12 @@ def crear_archivos(temporary_path, number=5):
for aux in range(len(fs)):
fits.writeto('%s/flat_%s.fits' % (temporary_path, aux), fs[aux],
header=header,
clobber=True)
overwrite=True)

result = generate_bias(detector, number, temporary_path)
result.master_bias.frame.writeto(
'%s/master_bias_data0.fits' % temporary_path,
clobber=True) # Master Bias
overwrite=True) # Master Bias

ob = ObservationResult()
ob.instrument = 'MEGARA'
Expand All @@ -97,6 +97,6 @@ def crear_archivos(temporary_path, number=5):
ri = recipe.create_input(obresult=ob, master_bias=DataFrame(
filename=open(temporary_path + '/master_bias_data0.fits').name))
aux = recipe.run(ri)
aux.master_bpm.frame.writeto('%s/master_bpm.fits' % temporary_path, clobber=True)
aux.master_bpm.frame.writeto('%s/master_bpm.fits' % temporary_path, overwrite=True)

return names
4 changes: 2 additions & 2 deletions megaradrp/recipes/calibration/tests/test_bpm_corrector.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@ def run(self, rinput):
reduced1 = img

fits.writeto(self.directorio + '/reduced_flat.fits', reduced1[0].data,
clobber=True)
overwrite=True)

fits.writeto(self.directorio + '/reduced_flat_bpm.fits',
reduced1[0].data, clobber=True)
reduced1[0].data, overwrite=True)

return self.create_result()

Expand Down
4 changes: 2 additions & 2 deletions megaradrp/recipes/calibration/tests/test_dark.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def test_dark():
qe = 0.8 * numpy.ones(DSHAPE)
config_uuid = '4fd05b24-2ed9-457b-b563-a3c618bb1d4c'
temporary_path = mkdtemp()
fits.writeto('%s/eq.fits' % temporary_path, qe, clobber=True)
fits.writeto('%s/eq.fits' % temporary_path, qe, overwrite=True)

readpars1 = ReadParams(gain=gain, ron=ron, bias=bias)
readpars2 = ReadParams(gain=gain, ron=ron, bias=bias)
Expand All @@ -54,7 +54,7 @@ def test_dark():
fs = simulate_dark_fits(factory, detector, exposure=3600, repeat=number)

for idx, aux in enumerate(fs):
aux.writeto('%s/dark_%s.fits' % (temporary_path, idx), clobber=True)
aux.writeto('%s/dark_%s.fits' % (temporary_path, idx), overwrite=True)

header = fits.Header()
header['DATE-OBS'] = '2017-11-09T11:00:00.0'
Expand Down
2 changes: 1 addition & 1 deletion megaradrp/simulation/control.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ def run(self, exposure, repeat=1):
self.ob_data['count'] = count
fitsfile = self.factory.create(final, self.ob_data['name'], self)
_logger.info('save image %s', self.ob_data['name'])
fitsfile.writeto(self.ob_data['name'], clobber=True)
fitsfile.writeto(self.ob_data['name'], overwrite=True)

def config_info(self):
return {'ob_data': self.ob_data}
Expand Down
2 changes: 1 addition & 1 deletion megaradrp/simulation/instrument.py
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ def project_rss(vis_fibs_id, pseudo_slit, vph, detector, sigma, wl_in, spec_in,
spec_in_detector = out[:,::scale]
wl_in_detector = wl_in_super[:,::scale]

# fits.writeto('downsampled.fits', spec_in_detector, clobber=True)
# fits.writeto('downsampled.fits', spec_in_detector, overwrite=True)
ytrace = np.zeros_like(wl_in_detector)

# Y-positions of the traces
Expand Down
2 changes: 1 addition & 1 deletion megaradrp/tests/create.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,4 +88,4 @@ def create(image, direction='normal', bins='11'):
finaldata[ocol2] = 8

hdu = fits.PrimaryHDU(data=finaldata)
hdu.writeto(image, clobber=True)
hdu.writeto(image, overwrite=True)
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
},
install_requires=[
'numpy',
'astropy >= 1.0',
'astropy >= 2',
'scipy',
'numina >= 0.16',
'scikit-image',
Expand Down

0 comments on commit 07b6070

Please sign in to comment.