Skip to main content
`Ctrl`+`K`

# ScienceState

class astropy.utils.state.ScienceState

  Bases: `object`

  Science state subclasses are used to manage global items that can affect science results. Subclasses will generally override `validate` to convert from any of the acceptable inputs (such as strings) to the appropriate internal objects, and set an initial value to the `_value` member so it has a default.

  Examples

      class MyState(ScienceState):
          @classmethod
          def validate(cls, value):
              if value not in ('A', 'B', 'C'):
                  raise ValueError("Must be one of A, B, C")
              return value

  Methods Summary

  `get`() | Get the current science state value.
  `set`(value) | Set the current science state value.
  `validate`(value) | Validate the value and convert it to its native type, if necessary.

  Methods Documentation

  classmethod get()

    Get the current science state value.

  classmethod set(value)

    Set the current science state value.

  classmethod validate(value)

    Validate the value and convert it to its native type, if necessary.