Skip to content

Commit

Permalink
Remove redundant functions and rename (#15)
Browse files Browse the repository at this point in the history
* clarify that unpacked designations are preferred

* changelog
  • Loading branch information
dahlend authored May 3, 2024
1 parent fb80321 commit eae45d8
Show file tree
Hide file tree
Showing 9 changed files with 17 additions and 499 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Changed

- Change documentation to clarify that designations are unpacked.
- Updated MPC Obs codes to include NEO Surveyor with code C58.
- Updated NAIF ID list to include new designations for about 20-30 comets.
- Renamed underlying `_rust` binary to `_core`.
- Moved NAIF ID list to a dedicated CSV file which is read during compilation.
- Rename `population.diameter` to `population.power_law`.

### Removed

- Removed main belt construction tools, out of scope and not accurate enough.
- Removed redundant MPC name resolver function.


## [0.2.0] - 2024-3-16
Expand Down
27 changes: 0 additions & 27 deletions src/neospy/mpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -468,33 +468,6 @@ def pack_designation(unpacked):
return pack_provisional_designation(unpacked)


@lru_cache
def fetch_known_packed_principal_designations(force_download=False):
"""
Download the most recent copy of the MPCs orbit catalogue and create a dictionary
mapping all packed designations to the MPC's 'Principal Designation' for the object.
This principal designation is the primary packed provisional designation that the
object has. Since all objects have one of these regardless of whether or not they
are numbered.
"""
url = "https://minorplanetcenter.net/Extended_Files/mpcorb_extended.json.gz"
objs = cached_gzip_json_download(url, force_download)

mapper = {}

for o in objs:
desig = pack_provisional_designation(o["Principal_desig"])
for other_desg in o.get("Other_desigs", []):
other_desg = pack_provisional_designation(other_desg)
mapper[other_desg] = desig
if "Number" in o:
num = pack_permanent_designation(int(o["Number"][1:-1]))
mapper[num] = desig
return mapper


@lru_cache()
def fetch_known_packed_designations(force_download=False):
"""
Expand Down
5 changes: 2 additions & 3 deletions src/neospy/population/__init__.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
from . import utils, main_belt, definitions, neas, diameters
from . import utils, definitions, neas, power_law

__all__ = [
"utils",
"main_belt",
"definitions",
"neas",
"diameters",
"power_law",
]
57 changes: 0 additions & 57 deletions src/neospy/population/definitions.py
Original file line number Diff line number Diff line change
Expand Up @@ -262,63 +262,6 @@ def which_group(
return groups


def mba_inner_complete(peri_dist, ecc, h_mag):
"""
Observationally complete set of inner main belt objects.
Returns `True` if the object is in the inner main belt and is a part of what is
expected to be observationally complete.
Parameters
----------
peri_dist:
Perihelion distance in units of AU.
ecc:
Eccentricity of the orbit.
h_mag:
The H magnitude of the object.
"""
return mba_inner(peri_dist, ecc) & (h_mag < 17.75)


def mba_middle_complete(peri_dist, ecc, h_mag):
"""
Observationally complete set of middle main belt objects.
Returns `True` if the object is in the middle main belt and is a part of what is
expected to be observationally complete.
Parameters
----------
peri_dist:
Perihelion distance in units of AU.
ecc:
Eccentricity of the orbit.
h_mag:
The H magnitude of the object.
"""
return mba_middle(peri_dist, ecc) & (h_mag < 17.25)


def mba_outer_complete(peri_dist, ecc, h_mag):
"""
Observationally complete set of outer main belt objects.
Returns `True` if the object is in the outer main belt and is a part of what is
expected to be observationally complete.
Parameters
----------
peri_dist:
Perihelion distance in units of AU.
ecc:
Eccentricity of the orbit.
h_mag:
The H magnitude of the object.
"""
return mba_outer(peri_dist, ecc) & (h_mag < 16.75)


def neo_amor_complete(peri_dist, ecc, h_mag):
"""
Observationally complete set of Amors.
Expand Down
Loading

0 comments on commit eae45d8

Please sign in to comment.