class WithNormalEnum(Container): class EventType(enum.Enum): pedestal = 1 physics = 2 calibration = 3 foo = Field(5, "foo field to test if this still works with more fields") event_type = Field( EventType.calibration, f"type of event, one of: {list(EventType.__members__.keys())}", ) bar = Field(10, "bar field to test if this still works with more fields")
class WithIntEnum(Container): class EventType(enum.IntEnum): pedestal = 1 physics = 2 calibration = 3 event_type = Field( EventType.calibration, f'type of event, one of: {list(EventType.__members__.keys())}')
class C1(Container): a = Field("a", None) b = Field("b", None)
class Container1(Container): b = Field(1, 'b') a = Field(2, 'a')
class C1(Container): a = Field('a', None) b = Field('b', None)
class Container2(Container): d = Field(3, "d") c = Field(4, "c")
class TestContainer(Container): value = Field(-1, "test")
class SomeContainer(Container): container_prefix = "" hillas_x = Field(1) hillas_y = Field(1)
class SomeContainer(Container): container_prefix = "" hillas_x = Field(None) hillas_y = Field(None) impact_x = Field(None) impact_y = Field(None)
class SomeContainer(Container): value = Field(-1, "some value that should be transformed")
class Container2(Container): container_prefix = "" string = Field("", "test string", max_length=10)
class Container1(Container): container_prefix = "" string = Field("", "test string")
class WithUnits(Container): inverse_length = Field(5 / u.m, 'foo') time = Field(1 * u.s, 'bar', unit=u.s) grammage = Field(2 * u.g / u.cm**2, 'baz', unit=u.g / u.cm**2)
class Container2(Container): d = Field(3, 'd') c = Field(4, 'c')
class ContainerA(Container): a = Field(0, "some integer field")
class SomeContainer(Container): container_prefix = "" image = Field(np.array([np.nan, np.inf, -np.inf]))
class WithUnits(Container): inverse_length = Field(5 / u.m, "foo") time = Field(1 * u.s, "bar", unit=u.s) grammage = Field(2 * u.g / u.cm**2, "baz", unit=u.g / u.cm**2)
class SomeContainer(Container): container_prefix = "" current = Field(1 * u.A, unit=u.uA) time = Field(NAN_TIME) image = Field(np.array([1.234, 123.456]))
class C1(Container): a = Field(None, "a") b = Field(None, "b")
class TimeContainer(Container): time = Field(None, "an astropy time")
class C2(Container): c = Field(None, "c") d = Field(None, "d")
class Container1(Container): b = Field(1, "b") a = Field(2, "a")
class C(Container): boolean = Field(True, "Boolean value")
class ContainerA(Container): a = Field(int)
class C(Container): value = Field(True, "Integer value")
class C2(Container): c = Field('c', None) d = Field('d', None)
class TestContainer(Container): value = Field(-1, 'test')