space-classy 0.3.7__tar.gz → 0.4__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {space_classy-0.3.7 → space_classy-0.4}/PKG-INFO +3 -3
- {space_classy-0.3.7 → space_classy-0.4}/classy/__init__.py +2 -2
- space_classy-0.4/classy/cache.py +48 -0
- {space_classy-0.3.7 → space_classy-0.4}/classy/cli.py +27 -10
- {space_classy-0.3.7 → space_classy-0.4}/classy/core.py +259 -202
- space_classy-0.4/classy/data.py +181 -0
- {space_classy-0.3.7 → space_classy-0.4}/classy/mixnorm.py +8 -11
- {space_classy-0.3.7 → space_classy-0.4}/classy/plotting.py +167 -54
- space_classy-0.4/classy/preprocessing.py +371 -0
- space_classy-0.4/classy/sources/__init__.py +9 -0
- space_classy-0.4/classy/sources/akari.py +122 -0
- space_classy-0.4/classy/sources/ecas.py +270 -0
- space_classy-0.4/classy/sources/gaia.py +123 -0
- space_classy-0.4/classy/sources/mithneos.py +2508 -0
- space_classy-0.4/classy/sources/smass.py +158 -0
- space_classy-0.4/classy/taxonomies/__init__.py +35 -0
- space_classy-0.4/classy/taxonomies/bus.py +0 -0
- space_classy-0.4/classy/taxonomies/demeo.py +489 -0
- space_classy-0.4/classy/taxonomies/mahlke.py +112 -0
- space_classy-0.4/classy/taxonomies/tholen.py +284 -0
- {space_classy-0.3.7 → space_classy-0.4}/classy/tools.py +13 -0
- {space_classy-0.3.7 → space_classy-0.4}/pyproject.toml +1 -1
- {space_classy-0.3.7 → space_classy-0.4}/setup.py +2 -2
- space_classy-0.3.7/classy/cache.py +0 -350
- space_classy-0.3.7/classy/data.py +0 -544
- space_classy-0.3.7/classy/preprocessing.py +0 -175
- {space_classy-0.3.7 → space_classy-0.4}/LICENSE +0 -0
- {space_classy-0.3.7 → space_classy-0.4}/README.md +0 -0
- {space_classy-0.3.7 → space_classy-0.4}/classy/classify.py +0 -0
- {space_classy-0.3.7 → space_classy-0.4}/classy/config.py +0 -0
- {space_classy-0.3.7 → space_classy-0.4}/classy/data/classy/classy_data.csv +0 -0
- {space_classy-0.3.7 → space_classy-0.4}/classy/data/input/classy_data_classified.csv +0 -0
- {space_classy-0.3.7 → space_classy-0.4}/classy/data/input/classy_data_preprocessed.csv +0 -0
- {space_classy-0.3.7 → space_classy-0.4}/classy/data/mcfa/mcfa.pkl +0 -0
- {space_classy-0.3.7 → space_classy-0.4}/classy/data/mixnorm/mixnorm.pkl +0 -0
- {space_classy-0.3.7 → space_classy-0.4}/classy/data/mixnorm/neighbours.csv +0 -0
- {space_classy-0.3.7 → space_classy-0.4}/classy/data/nironly_1_classified.csv +0 -0
- {space_classy-0.3.7 → space_classy-0.4}/classy/decision_tree.py +0 -0
- {space_classy-0.3.7 → space_classy-0.4}/classy/defs.py +0 -0
- {space_classy-0.3.7 → space_classy-0.4}/classy/gmm.py +0 -0
- /space_classy-0.3.7/classy/logging.py → /space_classy-0.4/classy/log.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: space-classy
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.4
|
|
4
4
|
Summary: classification tool for minor bodies using reflectance spectra and visual albedos
|
|
5
5
|
Home-page: https://github.com/maxmahlke/classy
|
|
6
6
|
License: MIT
|
|
@@ -23,10 +23,10 @@ Requires-Dist: pandas (>=1.4.2,<2.0.0)
|
|
|
23
23
|
Requires-Dist: rich (>=12.2.0,<13.0.0)
|
|
24
24
|
Requires-Dist: scikit-learn (>=1.2.1,<2.0.0)
|
|
25
25
|
Requires-Dist: space-rocks (>=1.7.2,<2.0.0)
|
|
26
|
-
Requires-Dist: sphinx (>=4,<5); extra == "docs"
|
|
26
|
+
Requires-Dist: sphinx (>=4,<5) ; extra == "docs"
|
|
27
27
|
Requires-Dist: sphinx-copybutton (>=0.5.0,<0.6.0)
|
|
28
28
|
Requires-Dist: sphinx-hoverxref
|
|
29
|
-
Requires-Dist: sphinx-redactor-theme (>=0.0.1,<0.0.2); extra == "docs"
|
|
29
|
+
Requires-Dist: sphinx-redactor-theme (>=0.0.1,<0.0.2) ; extra == "docs"
|
|
30
30
|
Requires-Dist: sphinx_design (>=0.3.0,<0.4.0)
|
|
31
31
|
Requires-Dist: tox (>=4.4.5,<5.0.0)
|
|
32
32
|
Project-URL: Documentation, https://classy.readthedocs.io/en/latest/
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"""Cache management for classy."""
|
|
2
|
+
|
|
3
|
+
from pathlib import Path
|
|
4
|
+
|
|
5
|
+
import numpy as np
|
|
6
|
+
import pandas as pd
|
|
7
|
+
import rocks
|
|
8
|
+
|
|
9
|
+
from classy import config
|
|
10
|
+
from classy.log import logger
|
|
11
|
+
from classy import core
|
|
12
|
+
from classy import sources
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
# ------
|
|
16
|
+
# Indeces of spectra
|
|
17
|
+
def load_index(source):
|
|
18
|
+
"""Load an index file."""
|
|
19
|
+
if source not in sources.SOURCES:
|
|
20
|
+
raise ValueError(
|
|
21
|
+
f"Unknown spectra source '{source}'. Choose one of {sources.SOURCES}."
|
|
22
|
+
)
|
|
23
|
+
|
|
24
|
+
return getattr(sources, source.lower()).load_index()
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
def load_mahlke_index():
|
|
28
|
+
"""Load the index of spectra from Mahlke+ 2022."""
|
|
29
|
+
PATH_INDEX = config.PATH_CACHE / "mahlke/index.csv"
|
|
30
|
+
return pd.read_csv(PATH_INDEX, dtype={"number": "Int64"})
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
# ------
|
|
34
|
+
# Load spectra from cache
|
|
35
|
+
def load_spectra(idx_spectra):
|
|
36
|
+
"""Load a spectrum from a known source.
|
|
37
|
+
|
|
38
|
+
Returns
|
|
39
|
+
-------
|
|
40
|
+
list of classy.core.Spectrum
|
|
41
|
+
"""
|
|
42
|
+
|
|
43
|
+
spectra = [
|
|
44
|
+
getattr(sources, spec.source.lower()).load_spectrum(spec)
|
|
45
|
+
for _, spec in idx_spectra.iterrows()
|
|
46
|
+
]
|
|
47
|
+
|
|
48
|
+
return spectra
|
|
@@ -9,10 +9,10 @@ import rocks
|
|
|
9
9
|
|
|
10
10
|
import classy.classify
|
|
11
11
|
from classy import core
|
|
12
|
-
from classy.
|
|
12
|
+
from classy.log import logger
|
|
13
13
|
import classy.preprocessing
|
|
14
|
-
from classy import
|
|
15
|
-
from classy import
|
|
14
|
+
from classy import taxonomies
|
|
15
|
+
from classy import sources
|
|
16
16
|
|
|
17
17
|
|
|
18
18
|
def _logging_option(func):
|
|
@@ -42,20 +42,37 @@ def docs():
|
|
|
42
42
|
@cli_classy.command()
|
|
43
43
|
@click.argument("id_", type=str)
|
|
44
44
|
@click.option("-c", "--classify", is_flag=True, help="Classify the spectra.")
|
|
45
|
-
@click.option(
|
|
46
|
-
|
|
45
|
+
@click.option(
|
|
46
|
+
"-t",
|
|
47
|
+
"--taxonomy",
|
|
48
|
+
default="mahlke",
|
|
49
|
+
help="Specify the taxonomic system.",
|
|
50
|
+
type=click.Choice(taxonomies.SYSTEMS),
|
|
51
|
+
)
|
|
52
|
+
@click.option(
|
|
53
|
+
"-s",
|
|
54
|
+
"--source",
|
|
55
|
+
type=click.Choice(sources.SOURCES),
|
|
56
|
+
multiple=True,
|
|
57
|
+
help="Select one or more online repositories.",
|
|
58
|
+
)
|
|
59
|
+
@click.option("-v", is_flag=True, help="Set verbose output.")
|
|
60
|
+
def spectra(id_, classify, taxonomy, source, v):
|
|
47
61
|
"""Retrieve, plot, classify spectra of an individual asteroid."""
|
|
48
62
|
|
|
63
|
+
if v:
|
|
64
|
+
classy.set_log_level("DEBUG")
|
|
65
|
+
|
|
49
66
|
name, number = rocks.id(id_)
|
|
50
67
|
|
|
51
68
|
if name is None:
|
|
52
69
|
logger.error("Cannot retrieve spectra for unidentified asteroid.")
|
|
53
70
|
sys.exit()
|
|
54
71
|
else:
|
|
55
|
-
logger.
|
|
72
|
+
logger.debug(f"Looking for reflectance spectra of ({number}) {name}")
|
|
56
73
|
|
|
57
|
-
if
|
|
58
|
-
source =
|
|
74
|
+
if not source:
|
|
75
|
+
source = classy.sources.SOURCES
|
|
59
76
|
|
|
60
77
|
# Load spectra
|
|
61
78
|
spectra = core.Spectra(id_, source=source)
|
|
@@ -65,7 +82,7 @@ def spectra(id_, classify, source):
|
|
|
65
82
|
|
|
66
83
|
# Classify
|
|
67
84
|
if classify:
|
|
68
|
-
spectra.classify()
|
|
85
|
+
spectra.classify(taxonomy=taxonomy)
|
|
69
86
|
|
|
70
87
|
# Plot
|
|
71
|
-
spectra.plot(add_classes=classify)
|
|
88
|
+
spectra.plot(add_classes=classify, taxonomy=taxonomy)
|