Selecting Spectra

classy makes it easy to select a set of spectra based on properties of either the spectra (e.g. wavelength range, feature presence) or the targets (e.g. taxonomic class, family membership). After adding spectra to the classy database, you can select spectra by specifying any combination of desired properties and values. You can do this on the command line using the spectra command to explore and visualize, and in a python script using the Spectra class for a more detailed analysis, covered in later chapters of this documentation.

List all available spectra of (4) Vesta.

$ classy spectra vesta
+-------+--------+----------+----------+----------+--------+---------------------+-------------------------+
| name  | number | wave_min | wave_max | source   | phase  | date_obs            | shortbib                |
+-------+--------+----------+----------+----------+--------+---------------------+-------------------------+
| Vesta | 4      | 0.337    | 1.041    | ECAS     | -      | -                   | Zellner+ 1985           |
| Vesta | 4      | 0.45     | 2.45     | MITHNEOS | 23.473 | 2009-11-18T15:48:34 | Unpublished             |
| Vesta | 4      | 0.645    | 2.553    | Misc     | 17.474 | 2010-03-27T07:45:35 | Reddy+ 2011             |
[...]
| Vesta | 4      | 0.374    | 1.034    | Gaia     | -      | -                   | Galluccio+ 2022         |
| Vesta | 4      | 0.435    | 2.49     | DM09     | 25.938 | 2000-10-09T00:00:00 | DeMeo+ 2009             |
| Vesta | 4      | 0.33     | 1.1      | 24CAS    | 21.286 | 1979-06-20T00:00:00 | Chapman and Gaffey 1979 |
| Vesta | 4      | 0.435    | 0.925    | SMASS    | 12.105 | 1996-04-18T00:00:00 | Bus and Binzel 2002     |
| Vesta | 4      | 0.902    | 1.644    | SMASS    | 1.346  | 1997-01-30T14:17:00 | Burbine and Binzel 2002 |
| Vesta | 4      | 0.829    | 2.57     | 52CAS    | 10.273 | 1985-05-05T00:00:00 | Bell+ 1988              |
+-------+--------+----------+----------+----------+--------+---------------------+-------------------------+
                                             33 Spectra

As shown above, by default, this prints a table of available spectra and relevant metadata. Use the --plot flag to visualise the spectra.

$ classy spectra vesta --plot

Retrieve all available spectra of (4) Vesta.

>>> import classy
>>> spectra = classy.Spectra(4)
>>> print(len(spectra))
33

For brevity, the outputs of the remaining examples in this section are not shown. After having completed the Getting Started section, all shown commands should run on your machine, and you can follow along by copy-pasting them.

Selection Syntax

All queries have the following basic syntax:

[Zero, one, or many target identifiers] [property1 name] [property1 value] [property2 name] [property2 value] [...]

The first part allows to specify any number of targets directly by passing an identifier:

Get all spectra of specified targets.

$ classy spectra vesta             # (4) Vesta
$ classy spectra 12 21             # (12) Victoria, (21) Lutetia
$ classy spectra julia sylvia 283  # (87) Sylvia, (89) Julia, (283) Emma

Get all spectra of specified targets.

>>> classy.Spectra("vesta")                  # (4) Vesta
>>> classy.Spectra([12, 21])                 # (12) Victoria, (21) Lutetia
>>> classy.Spectra(["julia", "sylvia", 283]) # (87) Sylvia, (89) Julia, (283) Emma

This target selection can be combined with or replaced by queries based on the spectra and target properties. Accepted property names are explained below. If the property is numeric (e.g. the target’s albedo), you can specify lower and upper limits by separating them with a comma: ,. To specify a one-sided limit, leave one side of the , blank.

Spectra of targets with albedos between 0.03 and 0.04.

$ classy spectra --albedo 0.03,0.04

Spectra observed at phase angles below 10 degree.

$ classy spectra --phase ,10

Spectra of targets with albedos between 0.03 and 0.04.

>>> classy.Spectra(albedo="0.03,0.04")

Spectra observed at phase angles below 10 degree.

>>> classy.Spectra(phase=',10')

An exception are the minimum and the maximum observed wavelength wave_min and wave_max, which are upper and lower limits by default.

Get spectra of (22) Kalliope which cover the entire visible-near-infrared range (0.45-2.45μm).

$ classy spectra 22 --wave_min 0.45 --wave_max 2.45

Get spectra of (22) Kalliope which cover the entire visible-near-infrared range (0.45-2.45μm).

>>> classy.Spectra(22, wave_min=0.45, wave_max=2.45)

For categorical values (e.g. taxonomy), you can select multiple acceptable values by separating them with a ,.

Spectra of B- and C-types with albedos above 0.1.

$ classy spectra --albedo 0.1, --taxonomy B,C

Spectra of B- and C-types with albedos above 0.1.

>>> classy.Spectra(albedo="0.1,", taxonomy="B,C")

Finally, you can express all queries in a logical format passed to the query parameter. This enables quite complex selection patterns.

Spectra of B- and C-types with minimum wavelengths below 0.3μm.

$ classy spectra --wave_min 0.35 --taxonomy B,C
$ classy spectra --query "wave_min < 0.35 & (taxonomy == 'B' | taxonomy == 'C')" # equivalent

Spectra of Tirela and Watsonia family members that are not L-types

$ classy spectra --family Tirela,Watsonia --query "taxonomy != 'L'"

Spectra of B- and C-types with minimum wavelengths below 0.3μm.

>>> classy.Spectra(wave_min=0.3, taxonomy="B,C")
>>> classy.Spectra(query="wave_min < 0.3 & (taxonomy == 'B' | taxonomy == 'C')") # equivalent

Spectra of Tirela and Watsonia family members that are not L-types

>>> classy.Spectra(family="Tirela,Watsonia", query="taxonomy != 'L'")

You can learn more about the query syntax here.

Selection Criteria

Selection criteria for spectra can be divided into spectra-specific (e.g. wavelength range, phase angle) and target-specific (e.g. taxonomy, albedo).

Spectra-Specific

classy keeps an index of all spectra and the relevant metadata in its database. Spectra-specific queries can make use of this metadata:

Property

Description

Example

wave_min

Minimum observed wavelength in μm

$ classy spectra eos --wave_min 0.4

wave_max

Maximum observed wavelength in μm

$ classy spectra eos --wave_max 1.2

phase

Phase angle of target at epoch of observation

$ classy spectra --phase 0,20

source

Source of spectrum (e.g. survey like ‘Gaia’)

$ classy spectra ceres pallas --source MITHNEOS,Gaia

shortbib

Shortbib of source publication

$ classy spectra  --shortbib "Marsset+ 2014"

date_obs

Epoch of observation

$ classy spectra bennu --date_obs 2008,

N

Number of wavelength samples in spectrum

$ classy spectra vesta --N 500,

feature

Presence of given feature in spectrum

$ classy spectra egeria --feature h

Selecting based on feature presence can be done after populating the feature index via the feature detection interface. The feature property one or several of the e, h, and k features.

Spectra of Themis family members which have a 0.7μm band.

$ classy spectra --feature h --family Themis

Spectra of Themis family members which have a 0.7μm band.

>>> classy.Spectra(family="Themis", feature="h")

Target-Specific

When selecting spectra based on properties of the targets (e.g. taxonomy, albedo), classy uses rocks to identify targets fitting these criteria via the SsODNet ssobft, a table containing a large number of best-estimate properties of all known minor bodies.[1] Valid selection criteria are all columns in the ssoBFT, specified using the entire column name. Due to the . in the ssoBFT column names, queries using the python interface have to use the query parameter.

Get spectra of potentially hazardous objects.

$ classy spectra --moid.EMB.value ,005 --H ,22

Get spectra of potentially hazardous objects.

>>> classy.Spectra(query='moid.EMB.value <= 0.05', H=',22')

Frequently used target properties can be specified using shorthands, analogously to the spectra metadata:[2]

Property

Description

Example

albedo

Visual albedo

$ classy spectra --albedo 0.3,

diameter

Diameter in km

$ classy spectra --diameter ,10

family

Family name

$ classy spectra --family Hungaria,Eos

H

Absolute Magnitude

$ classy spectra --H 16.3,17

taxonomy

Taxonomic class

$ classy spectra --taxonomy D,Z