Skip to content

Commit 0f57200

Browse files
author
licode
committed
DEV: better filename with more information as we do other designs here. And use db instead of db.mds
1 parent 82997a3 commit 0f57200

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

design/suitcase-update.rst renamed to design/suitcase-preprocess-data-binning.rst

+6-6
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ outputs h5 file with the same structure of the data in databroker.
1616
1717
from suitcase import hdf5
1818
last_run = db[-1] # get header from databroker
19-
hdf5.export(last_run, 'myfile.h5', mds=db.mds)
19+
hdf5.export(last_run, 'myfile.h5', db=db)
2020
2121
The first argument may be a single Header or a list of Headers. You can also use keyword "fields"
2222
in the "export" function to define specifically which data sets you want to output.
@@ -28,7 +28,7 @@ in the "export" function to define specifically which data sets you want to outp
2828
un_wanted_fields = ['A', 'B', 'C']
2929
fds = hdf5.filter_fields(hdr, un_wanted_fields)
3030
filename = 'scanID_123.h5'
31-
hdf5.export(hdr, filename, mds=db.mds, fields=fds)
31+
hdf5.export(hdr, filename, db=db, fields=fds)
3232
3333
Here I assume A, B, C are keywords for some vector data, like images. You can define them as un_wanted_fields.
3434
If all vector data are blocked, saving data with only scaler data and header information should be very faster.
@@ -55,7 +55,7 @@ solution 1: decorator
5555
return doc
5656
return rebinner
5757
58-
hdf5.export(last_run, 'myfile.h5', mds=db.mds, filter=make_rebinner(3, 'a'))
58+
hdf5.export(last_run, 'myfile.h5', db=db, filter=make_rebinner(3, 'a'))
5959
6060
6161
@@ -69,7 +69,7 @@ solution 2: partial function
6969
def rebinner(n, field, name, doc)
7070
make_rebinner = partial(rebinner, 3, 'a')
7171
72-
hdf5.export(last_run, 'myfile.h5', mds=db.mds, filter=make_rebinner)
72+
hdf5.export(last_run, 'myfile.h5', db=db, filter=make_rebinner)
7373
7474
7575
solution 3: use class
@@ -86,7 +86,7 @@ solution 3: use class
8686
def __call__()self, name, doc):
8787
...
8888
89-
hdf5.export(last_run, 'myfile.h5', mds=db.mds, filter=ReBinner(3, 'a'))
89+
hdf5.export(last_run, 'myfile.h5', db=db, filter=ReBinner(3, 'a'))
9090
9191
We can use base class from bluesky.
9292

@@ -95,6 +95,6 @@ solution 4: based on original export function
9595

9696
.. code-block:: python
9797
98-
hdf5.export(last_run, 'myfile.h5', mds=db.mds, filter, filter_kwargs)
98+
hdf5.export(last_run, 'myfile.h5', db=db, filter, filter_kwargs)
9999
100100
# use filter function as filter(name, doc, filter_kwargs)

0 commit comments

Comments
 (0)