1 """Temperature measurement tools
3 Fairly stubby, since a one shot temperature measurement is a common
4 thing. We just wrap that to provide a consistent interface.
7 from . import LOG as _LOG
8 from .temperature_analyze import analyze as _analyze
9 from .temperature_analyze import save as _save
12 def acquire(get=None):
13 """Measure the current temperature of the sample,
16 _LOG.info('measure temperature')
22 def run(get, config, filename, group='/'):
23 """Wrapper around acquire(), analyze(), save().
27 >>> from h5config.storage.hdf5 import HDF5_Storage, pprint_HDF5
28 >>> from .config import TemperatureConfig
30 >>> fd,filename = tempfile.mkstemp(suffix='.h5', prefix='calibcant-')
33 >>> config = TemperatureConfig()
37 ... get=get, config=config, filename=filename, group='/')
38 >>> pprint_HDF5(filename) # doctest: +ELLIPSIS, +REPORT_UDIFF
42 <HDF5 dataset "sleep": shape (), type "<i4">
45 <HDF5 dataset "data": shape (), type "<f8">
47 <HDF5 dataset "units": shape (), type "|S1">
50 <HDF5 dataset "data": shape (), type "<f8">
52 <HDF5 dataset "units": shape (), type "|S1">
55 Cleanup our temporary config file.
57 >>> os.remove(filename)
60 _LOG.debug('got temperature: {} K'.format(raw))
61 processed = _analyze(config=config, temperature=raw)
62 _save(filename=filename, group=group, config=config, raw=raw,