Skip to content

Commit

Permalink
fixed leftover bugs from skimage and jplhorizons switches
Browse files Browse the repository at this point in the history
  • Loading branch information
mommermi committed Nov 12, 2018
1 parent 74e3f7d commit 405dc42
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
21 changes: 21 additions & 0 deletions diagnostics.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,13 @@ def create_index(filenames, directory, obsparam,
# clip extreme values
imgdat = np.clip(imgdat, np.percentile(imgdat, 1),
np.percentile(imgdat, 99))

# normalize imgdat to pixel values 0 < px < 1
if np.min(imgdat) < 0:
imgdat = imgdat + np.min(imgdat)
if np.max(imgdat) > 1:
imgdat = imgdat / np.max(imgdat)

imgdat = resize(imgdat,
(min(imgdat.shape[0], 1000),
min(imgdat.shape[1], 1000)))
Expand Down Expand Up @@ -312,6 +319,13 @@ def add_registration(data, extraction_data, imagestretch='linear'):
imgdat = fits.open(dat['fits_filename'],
ignore_missing_end=True)[0].data
resize_factor = min(1., 1000./np.max(imgdat.shape))

# normalize imgdat to pixel values 0 < px < 1
if np.min(imgdat) < 0:
imgdat = imgdat + np.min(imgdat)
if np.max(imgdat) > 1:
imgdat = imgdat / np.max(imgdat)

imgdat = resize(imgdat,
(min(imgdat.shape[0], 1000),
min(imgdat.shape[1], 1000)))
Expand Down Expand Up @@ -634,6 +648,13 @@ def add_calibration(data, imagestretch='linear'):
'.fits'
imgdat = fits.open(fits_filename, ignore_missing_end=True)[0].data
resize_factor = min(1., 1000./np.max(imgdat.shape))

# normalize imgdat to pixel values 0 < px < 1
if np.min(imgdat) < 0:
imgdat = imgdat + np.min(imgdat)
if np.max(imgdat) > 1:
imgdat = imgdat / np.max(imgdat)

imgdat = resize(imgdat,
(min(imgdat.shape[0], 1000),
min(imgdat.shape[1], 1000)))
Expand Down
2 changes: 1 addition & 1 deletion pp_combine.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ def combine(filenames, obsparam, comoving, targetname,
logging.info('ephemerides for %s pulled from Horizons' %
targetname)
logging.info('Horizons call: %s' %
eph.query)
obj.uri)

target_ra, target_dec = eph[0]['RA'], eph[0]['DEC']

Expand Down

0 comments on commit 405dc42

Please sign in to comment.