Skip to content

Commit

Permalink
move help_texts from bossnet to glossary
Browse files Browse the repository at this point in the history
  • Loading branch information
andycasey committed Oct 30, 2024
1 parent 6f9eaf7 commit 5dc981e
Showing 1 changed file with 17 additions and 27 deletions.
44 changes: 17 additions & 27 deletions src/astra/models/bossnet.py
Original file line number Diff line number Diff line change
@@ -1,24 +1,14 @@
import numpy as np
import datetime
from peewee import (
AutoField,
FloatField,
TextField,
ForeignKeyField,
BitField,
DateTimeField
)
from playhouse.hybrid import hybrid_property

from astra import __version__
from astra.fields import (AutoField, FloatField, TextField, ForeignKeyField, BitField, DateTimeField)
from astra.models.base import BaseModel
from astra.models.fields import BitField
from astra.models.source import Source
from astra.models.spectrum import Spectrum
from astra.models.pipeline import PipelineOutputMixin

from astra.glossary import Glossary

class BossNet(BaseModel, PipelineOutputMixin):

"""A result from the BOSSNet pipeline."""
Expand All @@ -28,33 +18,33 @@ class BossNet(BaseModel, PipelineOutputMixin):
Spectrum,
index=True,
lazy_load=False,
help_text=Glossary.spectrum_pk
)

#> Astra Metadata
task_pk = AutoField(help_text=Glossary.task_pk)
v_astra = TextField(default=__version__, help_text=Glossary.v_astra)
created = DateTimeField(default=datetime.datetime.now, help_text=Glossary.created)
t_elapsed = FloatField(null=True, help_text=Glossary.t_elapsed)
t_overhead = FloatField(null=True, help_text=Glossary.t_overhead)
tag = TextField(default="", index=True, help_text=Glossary.tag)
task_pk = AutoField()
v_astra = TextField(default=__version__)
created = DateTimeField(default=datetime.datetime.now)
modified = DateTimeField(default=datetime.datetime.now)
t_elapsed = FloatField(null=True)
t_overhead = FloatField(null=True)
tag = TextField(default="", index=True)

#> Stellar Parameters
teff = FloatField(null=True, help_text=Glossary.teff)
e_teff = FloatField(null=True, help_text=Glossary.e_teff)
logg = FloatField(null=True, help_text=Glossary.logg)
e_logg = FloatField(null=True, help_text=Glossary.e_logg)
fe_h = FloatField(null=True, help_text=Glossary.fe_h)
e_fe_h = FloatField(null=True, help_text=Glossary.e_fe_h)
result_flags = BitField(default=0, help_text=Glossary.result_flags)
teff = FloatField(null=True)
e_teff = FloatField(null=True)
logg = FloatField(null=True)
e_logg = FloatField(null=True)
fe_h = FloatField(null=True)
e_fe_h = FloatField(null=True)
result_flags = BitField(default=0)
flag_runtime_exception = result_flags.flag(2**0, help_text="Exception occurred at runtime")
flag_unreliable_teff = result_flags.flag(2**1, help_text="`teff` is outside the range of 1700 K and 100,000 K")
flag_unreliable_logg = result_flags.flag(2**2, help_text="`logg` is outside the range of -1 and 10")
flag_unreliable_fe_h = result_flags.flag(2**3, help_text="`teff` < 3200 K or `logg` > 5 or `fe_h` is outside the range of -4 and 2")
flag_suspicious_fe_h = result_flags.flag(2**4, help_text="[Fe/H] below `teff` < 3900 K and with 3 < `logg` < 6 may be suspicious")

v_rad = FloatField(null=True, help_text=Glossary.v_rad)
e_v_rad = FloatField(null=True, help_text=Glossary.e_v_rad)
bn_v_r = FloatField(null=True)
e_bn_v_r = FloatField(null=True)

@hybrid_property
def flag_warn(self):
Expand Down

0 comments on commit 5dc981e

Please sign in to comment.