Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump astropy from 4.2.1 to 5.3.3 in /neoexchange #638

Open
wants to merge 11 commits into
base: main
Choose a base branch
from
Open
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ COPY neoexchange/requirements.txt .
# missing numpy.distutils.core reference because the package's setup.py is broken
RUN pip3 --no-cache-dir install --upgrade pip \
&& python3 -m pip --no-cache-dir install --upgrade numpy wheel \
&& python3 -m pip --no-cache-dir install --trusted-host buildsba.lco.gtn -r requirements.txt
&& python3 -m pip --no-cache-dir install -r requirements.txt

# Add path to findorb
ENV PATH=/root/bin:$PATH
Expand Down
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ Portal for scheduling observations of NEOs (and other Solar System objects) usin

## History

### 3.16.0
* Upgrade Astropy to 5.3.4 and pyslalib to 1.0.9 for newer build support.

### 3.15.2
* Add suport for disabling SSL verification in data pulls for emergency use e.g. for the recent MPC website issues. (Issue #646)

Expand Down
16 changes: 12 additions & 4 deletions neoexchange/core/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -3137,9 +3137,12 @@ def ingest_new_object(orbit_file, obs_file=None, dbg=False):
if obs_file is None:
obs_file = orbit_file.replace('neocp', 'dat')

# If not found, try new-style obs file name
# If not found, try new-style obs file names
if os.path.exists(obs_file) is False:
obs_file = orbit_file.replace('.neocp', '_mpc.dat')
# If still not found, try another new-style obs file name
if os.path.exists(obs_file) is False:
obs_file = orbit_file.replace('.neocp', '_mpc.txt')

local_discovery = False
try:
Expand Down Expand Up @@ -4655,14 +4658,16 @@ def compare_NEOx_horizons_ephems(body, d, sitecode='500', debug=True):
if type(body) != Body:
body = Body.objects.get(name=body)

neox_emp = compute_ephem(d, model_to_dict(body), sitecode, perturb=True, display=debug)
neox_emp = compute_ephem(d, model_to_dict(body), sitecode, perturb=False, display=debug)
neox_perturb_emp = compute_ephem(d, model_to_dict(body), sitecode, perturb=True, display=debug)
horizons_emp = horizons_ephem(body.current_name(), d, d+timedelta(minutes=1), sitecode, '1m')

sep_r = None
sep_ra = None
sep_dec = None
if len(neox_emp) > 0 and horizons_emp is not None and len(horizons_emp) > 0:
if len(neox_emp) > 0 and len(neox_perturb_emp) > 0 and horizons_emp is not None and len(horizons_emp) > 0:
neox_pos = SkyCoord(neox_emp['ra'], neox_emp['dec'], unit=u.rad)
neox_perturb_pos = SkyCoord(neox_perturb_emp['ra'], neox_perturb_emp['dec'], unit=u.rad)
# Find index of nearest in time ephememeris line
horizons_index = np.abs(d-horizons_emp['datetime'].datetime).argmin()
horizons_pos = SkyCoord(horizons_emp['RA'][horizons_index], horizons_emp['DEC'][horizons_index], unit=u.deg)
Expand All @@ -4673,7 +4678,10 @@ def compare_NEOx_horizons_ephems(body, d, sitecode='500', debug=True):
sep_ra, sep_dec = horizons_pos.spherical_offsets_to(neox_pos)
sep_ra = -sep_ra.to(u.arcsec) / cos(horizons_pos.dec.rad)
sep_dec = -sep_dec.to(u.arcsec)
print(f"At {d:} (HORIZONS@{horizons_emp['datetime'][horizons_index]} , sep= {sep_r:.1f} (RA={sep_ra:.1f}, Dec={sep_dec:.1f})\nNEOX: {neox_pos.to_string('hmsdms', sep=' ', precision=4):} V={neox_emp['mag']:.1f}\n JPL: {horizons_pos.to_string('hmsdms', sep=' ', precision=4):} V={horizons_emp[mag_column][horizons_index]:.1f}")
sep_perturb_ra, sep_perturb_dec = horizons_pos.spherical_offsets_to(neox_perturb_pos)
sep_perturb_ra = -sep_perturb_ra.to(u.arcsec) / cos(horizons_pos.dec.rad)
sep_perturb_dec = -sep_perturb_dec.to(u.arcsec)
print(f"At {d:} (HORIZONS@{horizons_emp['datetime'][horizons_index]} , sep= {sep_r:.1f} (RA={sep_ra:.1f}, Dec={sep_dec:.1f})\nNEOX(P): {neox_perturb_pos.to_string('hmsdms', sep=' ', precision=4):} V={neox_perturb_emp['mag']:.1f}\nNEOX(U): {neox_pos.to_string('hmsdms', sep=' ', precision=4):} V={neox_emp['mag']:.1f}\n JPL: {horizons_pos.to_string('hmsdms', sep=' ', precision=4):} V={horizons_emp[mag_column][horizons_index]:.1f}")

return neox_emp, horizons_emp, sep_r, sep_ra, sep_dec

Expand Down
2 changes: 1 addition & 1 deletion neoexchange/neox/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import rollbar


VERSION = '3.15.2'
VERSION = '3.16.0a'

CURRENT_PATH = os.path.dirname(os.path.realpath(__file__))
PRODUCTION = True if CURRENT_PATH.startswith('/var/www') else False
Expand Down
4 changes: 2 additions & 2 deletions neoexchange/photometrics/pds_subs.py
Original file line number Diff line number Diff line change
Expand Up @@ -369,13 +369,13 @@ def create_image_filter(header, nsmap):
etree.SubElement(optical_filter, etree.QName(img_ns, "filter_name")).text = obs_filter

obs_filter_bwidth = map_filter_to_bandwidth(obs_filter)
if obs_filter_bwidth:
if obs_filter_bwidth is not None:
obs_filter_bwidth_str = "{:.1f}".format(obs_filter_bwidth.value)
obs_filter_bwidth_unit = str(obs_filter_bwidth.unit)
etree.SubElement(optical_filter, etree.QName(img_ns, "bandwidth"), attrib={'unit' : obs_filter_bwidth_unit}).text = obs_filter_bwidth_str

obs_filter_cwave = map_filter_to_wavelength(obs_filter)
if obs_filter_cwave:
if obs_filter_cwave is not None:
obs_filter_cwave_str = "{:.1f}".format(obs_filter_cwave.value)
obs_filter_cwave_unit = str(obs_filter_cwave.unit)
etree.SubElement(optical_filter, etree.QName(img_ns, "center_filter_wavelength"), attrib={'unit' : obs_filter_cwave_unit}).text = obs_filter_cwave_str
Expand Down
4 changes: 2 additions & 2 deletions neoexchange/photometrics/photometry_subs.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,14 +145,14 @@ def sky_brightness_model(params, dbg=False):
# Assume a value of 60.0 in S10 units for the zodiacal light if the
# latitude wasn't given or calculable
q_zodi = 60.0
if ecliptic_lat:
if ecliptic_lat is not None:
if type(ecliptic_lat) == float:
ecliptic_lat = ecliptic_lat * u.deg
if ecliptic_lat.to(u.deg).value < 60.0:
q_zodi = 140.0 - 90.0 * sin(radians(ecliptic_lat.value))

q_stars = 0.0
if galactic_lat:
if galactic_lat is not None:
if type(galactic_lat) == float:
galactic_lat = galactic_lat * u.deg
q_stars = 100.0 * exp(-abs(galactic_lat.to(u.deg).value/10.0))
Expand Down
14 changes: 7 additions & 7 deletions neoexchange/photometrics/tests/test_catalog_subs.py
Original file line number Diff line number Diff line change
Expand Up @@ -1376,8 +1376,8 @@ def test_ldac_read_catalog(self):
unexpected_value = {}

hdr, tbl, cattype = open_fits_catalog(self.test_ldacfilename)
self.assertNotEqual(unexpected_value, hdr)
self.assertNotEqual(unexpected_value, tbl)
self.assertNotEqual(len(unexpected_value), len(hdr))
self.assertNotEqual(len(unexpected_value), len(tbl))
self.assertNotEqual(unexpected_value, cattype)

def test_ldac_catalog_read_length(self):
Expand Down Expand Up @@ -1444,12 +1444,12 @@ def test_banzai_read_catalog(self):
unexpected_value = {}

hdr, tbl, cattype = open_fits_catalog(self.test_banzaifilename)
self.assertNotEqual(unexpected_value, hdr)
self.assertNotEqual(unexpected_value, tbl)
self.assertNotEqual(len(unexpected_value), len(hdr))
self.assertNotEqual(len(unexpected_value), len(tbl))
self.assertNotEqual(unexpected_value, cattype)

def test_banzai_catalog_read_length(self):
expected_hdr_len = 278-23 # Total-compression keywords
expected_hdr_len = 278-26 # Total-compression keywords
expected_tbl_len = len(self.test_banzaitable)
expected_cattype = 'BANZAI'

Expand Down Expand Up @@ -1489,8 +1489,8 @@ def test_uncomp_banzai_read_catalog(self):
unexpected_value = {}

hdr, tbl, cattype = open_fits_catalog(self.test_uncomp_banzaifilename)
self.assertNotEqual(unexpected_value, hdr)
self.assertNotEqual(unexpected_value, tbl)
self.assertNotEqual(len(unexpected_value), len(hdr))
self.assertNotEqual(len(unexpected_value), len(tbl))
self.assertNotEqual(unexpected_value, cattype)

def test_uncomp_banzai_catalog_read_length(self):
Expand Down
10 changes: 5 additions & 5 deletions neoexchange/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
numpy==1.22.4; sys_platform != 'win32'
numpy==1.22.4+mkl; sys_platform == 'win32'
numpy==1.23.5; sys_platform != 'win32'
numpy==1.23.5+mkl; sys_platform == 'win32'
Django>=4.2.10,<5.0
#mysqlclient~=1.4.3
psycopg2-binary
astropy==4.2.1
astropy<6.0
astroquery>=0.4.4.dev7007
photutils==1.3.0 # Higher versions need astropy>=5.0
pySLALIB
photutils==1.11.0 # Higher versions need python>=3.10
pyslalib>=1.0.9
beautifulsoup4
django-reversion
html5lib
Expand Down