diff --git a/src/amuse/units/stellar_types.py b/src/amuse/units/stellar_types.py new file mode 100644 index 0000000000..f2efe7e15e --- /dev/null +++ b/src/amuse/units/stellar_types.py @@ -0,0 +1,29 @@ +from amuse.units.si import core + +stellar_type = core.enumeration_unit( + 'stellar_type', + 'stellar_type', + None, + [ + "deeply or fully convective low mass MS star", # 0 + "Main Sequence star", # 1 + "Hertzsprung Gap", # 2 + "First Giant Branch", # 3 + "Core Helium Burning", # 4 + "First Asymptotic Giant Branch", # 5 + "Second Asymptotic Giant Branch", # 6 + "Main Sequence Naked Helium star", # 7 + "Hertzsprung Gap Naked Helium star", # 8 + "Giant Branch Naked Helium star", # 9 + "Helium White Dwarf", # 10 + "Carbon/Oxygen White Dwarf", # 11 + "Oxygen/Neon White Dwarf", # 12 + "Neutron Star", # 13 + "Black Hole", # 14 + "Massless Supernova", # 15 + "Unknown stellar type", # 16 + "Pre-main-sequence Star", # 17 + "Planet", # 18 + "Brown Dwarf", # 19 + ] +) diff --git a/src/amuse/units/units.py b/src/amuse/units/units.py index dc2d3c4786..eeab5a068f 100644 --- a/src/amuse/units/units.py +++ b/src/amuse/units/units.py @@ -3,27 +3,20 @@ """ import numpy -from amuse.units.si import ( - named, - s, - m, - kg, - none, - core, -) -from amuse.units.derivedsi import ( - km, - V, - W, - J, - Pa, - rad, -) -from amuse.units.si import * -from amuse.units.derivedsi import * -from amuse.units import constants +from . import constants from . import quantities +# The two imports below are to explicitly expose everything directly used in +# this module. +from .si import (named, s, m, kg, none, core, no_unit,) +from .derivedsi import (km, V, W, J, Pa, rad,) + +# importing * from si and derivedsi since we do want all of the units in these +# modules, and we don't want to repeat everything here. +from .si import * +from .derivedsi import * +from .stellar_types import stellar_type + # misc every day minute = named("minute", "min", 60.0 * s) hour = named("hour", "hr", 60.0 * minute) @@ -57,7 +50,6 @@ Mpc = named("mega parsec", "Mpc", 10**6 * parsec) Gpc = named("giga parsec", "Gpc", 10**9 * parsec) lightyear = named("light year", "ly", 9460730472580.8 * km) -# lightyear = named('light year', 'ly', c*julianyr) LSun = named("solar luminosity", "LSun", 3.839e26 * W) MSun = named("solar mass", "MSun", 1.98892e30 * kg) RSun = named("solar radius", "RSun", 6.955e8 * m) @@ -99,39 +91,10 @@ string = core.string_unit("string", "string") -stellar_type = core.enumeration_unit( - "stellar_type", - "stellar_type", - None, - [ - "deeply or fully convective low mass MS star", # 0 - "Main Sequence star", # 1 - "Hertzsprung Gap", # 2 - "First Giant Branch", # 3 - "Core Helium Burning", # 4 - "First Asymptotic Giant Branch", # 5 - "Second Asymptotic Giant Branch", # 6 - "Main Sequence Naked Helium star", # 7 - "Hertzsprung Gap Naked Helium star", # 8 - "Giant Branch Naked Helium star", # 9 - "Helium White Dwarf", # 10 - "Carbon/Oxygen White Dwarf", # 11 - "Oxygen/Neon White Dwarf", # 12 - "Neutron Star", # 13 - "Black Hole", # 14 - "Massless Supernova", # 15 - "Unknown stellar type", # 16 - "Pre-main-sequence Star", # 17 - "Planet", # 18 - "Brown Dwarf", # 19 - ], -) - # special unit for keys of particles object_key = core.key_unit("object_key", "key") # angles -# rad=named('radian','rad',m/m) (defined in derivedsi.py) pi = numpy.pi | rad rev = named("revolutions", "rev", (2 * numpy.pi) * rad) deg = named("degree", "deg", (numpy.pi / 180) * rad)