Skip to content

Commit 1d8c214

Browse files
committed
Adding last comments for Python Interface version 1.4 delivery
1 parent add4651 commit 1d8c214

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

89 files changed

+83626
-3288
lines changed

.gitlab-ci.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
stages:
2+
- test
3+
4+
python_tests:
5+
image: python:3.8.10
6+
stage: test
7+
script:
8+
- python3 -m venv venv
9+
- source venv/bin/activate ven
10+
- pip install astroquery # For testing
11+
- pip install wheel # To create wheel of ESANEOCC
12+
- pip install coverage
13+
- python setup.py bdist_wheel
14+
- pip install .
15+
- pip install -r requirements.txt
16+
- coverage run -m pytest -rp test/test*.py
17+
- coverage report ESANEOCC/*.py

ESANEOCC.pdf

1.48 KB
Binary file not shown.

ESANEOCC/__init__.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,6 @@ class Conf(_config.ConfigNamespace):
1919
API_URL = _config.ConfigItem(BASE_URL +
2020
'PSDB-portlet/download?file=')
2121

22-
PROPERTIES_URL = _config.ConfigItem(BASE_URL +
23-
'search-for-asteroids?tab='
24-
'physprops&des=')
25-
2622
EPHEM_URL = _config.ConfigItem(BASE_URL +
2723
'PSDB-portlet/ephemerides?des=')
2824

ESANEOCC/core.py

Lines changed: 37 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
* Property: European Space Agency (ESA)
1010
* Developed by: Elecnor Deimos
1111
* Author: C. Álvaro Arroyo Parejo
12-
* Issue: 1.3.1
13-
* Date: 29-06-2021
12+
* Issue: 1.4.0
13+
* Date: 02-11-2021
1414
* Purpose: Main module which gets NEAs data from https://neo.ssa.esa.int/
1515
* Module: core.py
1616
* History:
@@ -32,6 +32,9 @@
3232
implementation.\n
3333
Define methods as static.\n
3434
1.3.1 29-06-2021 No changes
35+
1.4.0 29-10-2021 Adding new docstrings.\n
36+
Change method for obtaining physical
37+
properties
3538
======== =========== ============================================
3639
3740
@@ -66,6 +69,8 @@ def query_list(list_name):
6669
* Priority list (faint): *priority_list_faint*
6770
* Close encounter list: *close_encounter*
6871
* Impacted objects: *impacted_objects*
72+
* Catalogue of NEAs (current date): *neo_catalogue_current*
73+
* Catalogue of NEAs (middle arc): *neo_catalogue_middle*
6974
7075
These lists are referenced in https://neo.ssa.esa.int/computer-access
7176
@@ -75,7 +80,8 @@ def query_list(list_name):
7580
Name of the requested list. Valid names are: *nea_list,
7681
updated_nea, monthly_update, risk_list, risk_list_special,
7782
close_approaches_upcoming, close_approaches_recent, priority_list,
78-
priority_list_faint, close_encounter and impacted_objects*.
83+
priority_list_faint, close_encounter, impacted_objects,
84+
neo_catalogue_current and neo_catalogue_middle*.
7985
8086
Returns
8187
-------
@@ -182,7 +188,7 @@ def query_list(list_name):
182188

183189
return neocc_list
184190

185-
except ConnectionError:
191+
except ConnectionError: # pragma: no cover
186192
print('Initial attempt to obtain list failed. Reattempting...')
187193
# Wait 5 seconds
188194
time.sleep(5)
@@ -315,28 +321,22 @@ def query_object(name, tab, **kwargs):
315321
>>> properties.<tab>
316322
properties.physical_properties properties.sources
317323
>>> properties.physical_properties
318-
Property Values Unit Source
319-
0 Rotation Period 5.27 h [4]
320-
1 Quality 4 - [4]
321-
2 Amplitude 0.04-1.49 mag [4]
322-
3 Rotation Direction PRO - [1]
323-
4 Spinvector L 16 deg [1]
324-
5 Spinvector B 9 deg [1]
325-
6 Taxonomy Sq - [2]
326-
7 Taxonomy (all) S - [3]
327-
8 Absolute Magnitude (H) 10.31 mag [5]
328-
9 Slope Parameter (G) 0.46** mag [6]
329-
10 Albedo 0.24 - [9]
330-
11 Diameter 23300 m [10]
331-
12 Color Index Information 0.39 R-I [11]
332-
13 Sightings Visual S - [13]
324+
Property Value(s) Units Reference(s)
325+
0 Rotation Period 5.27 h [4]
326+
1 Quality 4.0 - [4]
327+
2 Amplitude 0.04-1.49 mag [4]
328+
3 Rotation Direction PRO - [1]
329+
4 Spinvector L 16.0 deg [1]
330+
5 Spinvector B 9.0 deg [1]
331+
6 Taxonomy Sq - [2]
332+
7 Taxonomy (all) S - [3]
333+
8 Absolute Magnitude (H) [10.853, 10.31] [mag, mag] [[5], [6]]
334+
9 Slope Parameter (G) [0.46**, 0.2, 0.46**] [mag, mag, mag] [[7], [8], [5]]
335+
10 Albedo 0.24 - [9]
336+
11 Diameter 23300.0 m [10]
337+
12 Color Index Information [0.85, 0.48, 0.39, 0.52] [B-V, V-R, R-I, U-B] [[11], [11], [11], [12]]
338+
13 Sightings [Radar R, Visual S] [-, -] [[13], [14]]
333339
334-
Note
335-
----
336-
Some physical properties (e.g. *Absolute Mangnitude (H)*, *Slope
337-
Parameter (G)*, etc) may have several values which come from different
338-
sources. Currently, the library will only show one value as it is done
339-
in the NEOCC portal.
340340
341341
Note
342342
----
@@ -400,8 +400,8 @@ def query_object(name, tab, **kwargs):
400400
>>> ast_orbit_prop = neocc.query_object(name='99942',
401401
tab='orbit_properties',orbital_elements='keplerian', orbit_epoch='present')
402402
>>> ast_orbit_prop.<tab>
403-
ast_orbit_prop.anode ast_orbit_prop.moid
404-
ast_orbit_prop.aphelion ast_orbit_prop.ngr
403+
ast_orbit_prop.anode ast_orbit_prop.ngr
404+
ast_orbit_prop.aphelion ast_orbit_prop.orb_type
405405
ast_orbit_prop.cor ast_orbit_prop.perihelion
406406
ast_orbit_prop.cov ast_orbit_prop.period
407407
ast_orbit_prop.dnode ast_orbit_prop.pha
@@ -410,6 +410,7 @@ def query_object(name, tab, **kwargs):
410410
ast_orbit_prop.kep ast_orbit_prop.rms
411411
ast_orbit_prop.lsp ast_orbit_prop.u_par
412412
ast_orbit_prop.mag ast_orbit_prop.vinfty
413+
ast_orbit_prop.moid
413414
414415
**Ephemerides:** In order to access ephemerides information, it
415416
is necessary to provide five additional inputs to *query_object*
@@ -442,15 +443,16 @@ def query_object(name, tab, **kwargs):
442443
# following different methods. Create "switch" for each case:
443444

444445
# Impacts, close approaches and observations
445-
if tab in ('impacts', 'close_approaches', 'observations'):
446+
if tab in ('impacts', 'close_approaches', 'observations',
447+
'physical_properties'):
446448
# Get URL to obtain the data from NEOCC
447449
url = tabs.get_object_url(name, tab)
448450

449451
# Request data two times if the first attempt fails
450452
try:
451453
# Get object data
452454
data_obj = tabs.get_object_data(url)
453-
except ConnectionError:
455+
except ConnectionError: # pragma: no cover
454456
print('Initial attempt to obtain object data failed. '
455457
'Reattempting...')
456458
# Wait 5 seconds
@@ -471,13 +473,11 @@ def query_object(name, tab, **kwargs):
471473
neocc_obj = tabs.AsteroidObservations()
472474
# Get object with attributes from data
473475
neocc_obj._ast_obs_parser(data_obj)
474-
475-
# Physical properties
476-
elif tab == 'physical_properties':
477-
# Create empty object with class Physical properties
478-
neocc_obj = tabs.PhysicalProperties()
479-
# Parse the requested data using Physical properties parser
480-
neocc_obj._phys_prop_parser(name)
476+
elif tab == 'physical_properties':
477+
# Create empty object with class Physical properties
478+
neocc_obj = tabs.PhysicalProperties()
479+
# Parse the requested data using Physical properties parser
480+
neocc_obj._phys_prop_parser(data_obj)
481481
# Orbit properties
482482
elif tab == 'orbit_properties':
483483
# Raise error if no elements are provided
@@ -499,7 +499,7 @@ def query_object(name, tab, **kwargs):
499499
try:
500500
# Get object data
501501
data_obj = tabs.get_object_data(url)
502-
except ConnectionError:
502+
except ConnectionError: # pragma: no cover
503503
print('Initial attempt to obtain object data failed. '
504504
'Reattempting...')
505505
# Wait 5 seconds

0 commit comments

Comments
 (0)