diff --git a/documentation/SpectralTypes.md b/documentation/SpectralTypes.md index cedd6edec..34b2c6e4b 100644 --- a/documentation/SpectralTypes.md +++ b/documentation/SpectralTypes.md @@ -10,7 +10,7 @@ Columns marked with an asterisk (*) may not be empty. | spectral_type_string | Spectral type string | | String(20) | | | *spectral_type_code | Numeric code corresponding to spectral type | | Float | primary | | spectral_type_error | Uncertainty of spectral type | | Float | | -| regime | Regime for spectral type value | | | primary and foreign:Regimes.regime | +| *regime | Regime for spectral type value | | | primary and foreign:Regimes.regime | | adopted | Flag indicating if this is the adopted measurement | | Boolean | | | photometric | Flag indicating if this is a photometric spectral type | | Boolean | | | comments | Free form comments | | String(1000) | | @@ -21,4 +21,6 @@ Spectral Type Codes: - 69 = M9 - 70 = L0 - 80 = T0 - - 90 = Y0 \ No newline at end of file + - 90 = Y0 + + Regime is required however, regime = "unkwown" can be used when the regime is unknown. \ No newline at end of file diff --git a/simple/utils/spectral_types.py b/simple/utils/spectral_types.py index db962f793..5ba443c18 100644 --- a/simple/utils/spectral_types.py +++ b/simple/utils/spectral_types.py @@ -134,7 +134,11 @@ def ingest_spectral_type( ) if check == 1: msg = f"Spectral type for {db_name} already in the database" - raise AstroDBError(msg) + if raise_error: + logger.error(msg) + raise AstroDBError(msg) + else: + logger.warning(msg) logger.debug(f"Trying to insert {spt_data} into Spectral Types table ") @@ -181,17 +185,20 @@ def ingest_spectral_type( == 0 ): msg = f"The publication does not exist in the database: {reference}" - msg1 = "Add it with ingest_publication function." + msg1 = "Add it with astrodb_utils.ingest_publication function." logger.debug(msg + msg1) - raise AstroDBError(msg) - elif "NOT NULL constraint failed: SpectralTypes.regime" in str(e): - msg = f"The regime was not provided for {source}" - logger.error(msg) - raise AstroDBError(msg) + if raise_error: + logger.error(msg) + raise AstroDBError(msg + msg1) + else: + logger.warning(msg) else: msg = f"Spectral type ingest failed with error {e}\n" - logger.error(msg) - raise AstroDBError(msg) + if raise_error: + logger.error(msg) + raise AstroDBError(msg) + else: + logger.warning(msg) def convert_spt_string_to_code(spectral_type_string):