Skip to content

Commit 315fb75

Browse files
committed
fix some configcls docs
1 parent eb59900 commit 315fb75

File tree

5 files changed

+79
-22
lines changed

5 files changed

+79
-22
lines changed

docs/io_ancil.rst

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ io.ancil
66
:inherited-members:
77

88

9-
Engine configuration
9+
Module configuration
1010
--------------------
1111

1212
.. automodule:: sotodlib.io.ancil.configcls
@@ -17,14 +17,23 @@ Engine configuration
1717

1818
.. _io-ancil-engines:
1919

20-
Engines
21-
-------
20+
Modules
21+
--------
2222

23-
.. automodule:: sotodlib.io.ancil.apex
23+
Housekeeping Data
24+
``````````````````
25+
26+
.. automodule:: sotodlib.io.ancil.so_hk
2427
:members:
2528

26-
.. automodule:: sotodlib.io.ancil.pwv
29+
APEX radiometer
30+
```````````````
31+
32+
.. automodule:: sotodlib.io.ancil.apex
2733
:members:
2834

29-
.. automodule:: sotodlib.io.ancil.so_hk
35+
PWV combinations
36+
````````````````
37+
38+
.. automodule:: sotodlib.io.ancil.pwv
3039
:members:

sotodlib/io/ancil/apex.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
"""This ancil submodule specializes in radiometer data from the APEX
2+
telescope.
3+
4+
"""
5+
16
import logging
27
import math
38
import requests
@@ -30,7 +35,7 @@ def _to_timestamp(targets):
3035
a = a.strip().replace(' ', 'T')
3136
if 'T' not in a:
3237
a = a + 'T00:00:00'
33-
out.append(_str_to_timestamp(a))
38+
out.append(_str_to_timestamp(a))
3439
else:
3540
raise ValueError(f"Cannot interpret as timestamp: '{a}'")
3641
return np.array(out)

sotodlib/io/ancil/configcls.py

Lines changed: 47 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,9 @@
1212

1313
def register_engine(token: str, config_class):
1414
"""Class decorator used to register an AncilEngine in
15-
ANCIL_ENGINES and to define the config_class class variable. Use
16-
like this::
15+
ANCIL_ENGINES and to define the config_class class variable and to
16+
annotate the config_class docstring with a reference to the class.
17+
Use like this::
1718
1819
@cc.register_engine(cc.MyPreciousDataConfig, 'my-precious')
1920
class MyPreciousData(base.AncilEngine):
@@ -23,6 +24,10 @@ class MyPreciousData(base.AncilEngine):
2324
def _deco(cls):
2425
cls.engine_id = token
2526
cls.config_class = config_class
27+
m, n = config_class.__module__, config_class.__name__
28+
d = config_class.__doc__
29+
config_class.__doc__ += \
30+
f"\n\nConfig class for :class:`{m}.{n}`."
2631
ANCIL_ENGINES[token] = cls
2732
return cls
2833
return _deco
@@ -40,16 +45,30 @@ class AncilEngineConfig:
4045
#: value).
4146
dataset_name: str = None
4247

43-
#: Default prefix (directory) for base data archive storage.
48+
#: Prefix (directory name) for base data archive storage. This
49+
#: is intended to be set externally to some top-level storage
50+
#: location for some set of archives.
4451
data_prefix : str = None
52+
53+
#: Directory where data archive should be stored. This is taken
54+
#: relative to data_prefix, unless an absolute path is specified.
55+
#: Subclasses will usually recommend a value.
4556
data_dir: str = None
4657

4758
#: List of "friend" definitions that the class expects to have
4859
#: registered.
4960
friends : field(default_factory=list) = None
5061

51-
#: Test for obsdb query that finds records needing update
62+
#: Format string to use when turning internal field values into
63+
#: obsdb column names. This must be None or else include
64+
#: ``{field}``; it may also include ``{dataset}``, which will
65+
#: be replaced with the ``dataset_name``.
5266
obsdb_format: str = None
67+
68+
#: Query string to use on the obsdb for identifying records that
69+
#: require an update. Instead of field names, put each internal
70+
#: fieldname as a variable (e.g. ``{mean} is null``) and it will be
71+
#: reprocessed according to ``obsdb_format`` spec.
5372
obsdb_query: str = None
5473

5574

@@ -85,7 +104,7 @@ class HkExtractConfig(AncilEngineConfig):
85104
#: defines what fields are extracted and stored in the archive.
86105
aliases: dict = field(default_factory=dict)
87106

88-
#: hkdb config filename to target.
107+
#: Config file for accessing the relevant hkdb.
89108
hkdb_config: str = None
90109

91110
#: Number of seconds in each HDF5 base data file.
@@ -108,7 +127,13 @@ class HkExtractConfig(AncilEngineConfig):
108127
dtypes: dict = field(default_factory=dict)
109128

110129

111-
# Specific engine config.
130+
#
131+
# Specific engine config classes.
132+
#
133+
# Note that the register_engine decorator will automatically add a
134+
# simple class docstring that links back to the Engine class.
135+
#
136+
112137

113138
@dataclass
114139
class ApexPwvConfig(LowResTableConfig):
@@ -118,21 +143,28 @@ class ApexPwvConfig(LowResTableConfig):
118143
obsdb_query: str = '{mean} is null'
119144

120145

146+
@dataclass
147+
class TocoPwvConfig(LowResTableConfig):
148+
# Overrides.
149+
dataset_name: str = 'toco_pwv'
150+
obsdb_format: str = '{dataset}_{field}'
151+
obsdb_query: str = '{mean} is null and {start} is null and {end} is null'
152+
153+
#: Config file for accessing the site hkdb.
154+
hkdb_config: str = None
155+
156+
121157
@dataclass
122158
class PwvComboConfig(AncilEngineConfig):
123159
# Overrides.
124160
dataset_name: str = 'pwv'
125161
obsdb_format: str = '{dataset}_{field}'
126162
obsdb_query: str = '{mean} is null'
127163

164+
#: Name of the friend dataset from which to retrieve Toco
165+
#: radiometer data.
128166
toco_dataset: str = 'toco-pwv'
129-
apex_dataset: str = 'apex-pwv'
130-
131167

132-
@dataclass
133-
class TocoPwvConfig(LowResTableConfig):
134-
obsdb_query: str = '{mean} is null and {start} is null and {end} is null'
135-
136-
dataset_name: str = 'toco_pwv'
137-
obsdb_format: str = '{dataset}_{field}'
138-
hkdb_config: str = None
168+
#: Name of the friend dataset from which to retrieve APEX
169+
#: radiometer data.
170+
apex_dataset: str = 'apex-pwv'

sotodlib/io/ancil/pwv.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
"""This ancil submodule specializes in combining PWV readings from the
2+
APEX and Toco radiometers.
3+
4+
"""
5+
16
#
27
# Combine PWV data sources to get PWV stats for each observation.
38
#

sotodlib/io/ancil/so_hk.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
"""This ancil submodule specializes in datastreams saved to SO HK data feeds, including:
2+
3+
- the Toco radiometer data
4+
5+
"""
6+
17
import h5py
28
import logging
39
import math

0 commit comments

Comments
 (0)