bluesky / suitcase-tiff

http://nsls-ii.github.io/suitcase
Other
2 stars 5 forks source link

Format exporter's directory #22

Open EliotGann opened 5 years ago

EliotGann commented 5 years ago

It would be good to format the exporter's directory the same way we format the file_prefix.

Current behavior:

In [26]: tiff_series.export(db[-3].documents(fill=True), file_prefix='{start[institution]}-Eph={event[data][energy]}-{s
    ...: tart[scan_id]}-', directory='Z:/images/users/{start[user]}')
Out[26]:
{'stream_data': [WindowsPath('//XF07ID1-WS17/RSoXS Documents/images/users/{start[user]}/NIST-Eph=459.987181-40-primary-sw_det_saxs_image-0.tiff'),
  WindowsPath('//XF07ID1-WS17/RSoXS Documents/images/users/{start[user]}/NIST-Eph=459.987181-40-primary-sw_det_waxs_image-0.tiff'),
  WindowsPath('//XF07ID1-WS17/RSoXS Documents/images/users/{start[user]}/NIST-Eph=459.9903474-40-primary-sw_det_saxs_image-1.tiff'),
  WindowsPath('//XF07ID1-WS17/RSoXS Documents/images/users/{start[user]}/NIST-Eph=459.9903474-40-primary-sw_det_waxs_image-1.tiff'),
  WindowsPath('//XF07ID1-WS17/RSoXS Documents/images/users/{start[user]}/NIST-Eph=460.0084854-40-primary-sw_det_saxs_image-2.tiff'),
  WindowsPath('//XF07ID1-WS17/RSoXS Documents/images/users/{start[user]}/NIST-Eph=460.0084854-40-primary-sw_det_waxs_image-2.tiff')]}
awalter-bnl commented 5 years ago

PR #23 will resolve this issue

danielballan commented 5 years ago

In fact this is already possible without changes to suitcase. Try:

tiff_series.export(db[-3].documents(fill=True), file_prefix='{start[user]}/{start[institution]}-Eph={event[data][energy]}-{s
    ...: tart[scan_id]}-', directory='Z:/images/users')

That is, file_prefix is in general a relative filepath; it doesn’t have to be just a file name. We should add an example illustrating this in the docstring and the general suitcase documentation to make that clear.

Thedirectory must always be a plain, un-templated path. But this does not limit what you can do. In the extreme case you can set directory=’/‘ and put all the rest of the path in file_prefix if you need total flexibility. But usually there is some part of the path that means “location on system where the files go” and some part that means “subdirectories for specific group or experiment”.

danielballan commented 5 years ago

If reading this via email, note that my previous comment was significantly edited due to accidentally submitting it mid-sentence.

awalter-bnl commented 5 years ago

OK so after some more investigation I am 100% convinced that @danielballan is correct. we should update the docs to indicate (and include an example) that file_prefix can include path information as well as just a prefix for the file_name. This resolves the issue.

mrakitin commented 5 years ago

@danielballan, the suggested usage is pretty clear, I like it. Let's refer to it the same way we do with root and write_path_template of AD plugins: the former should be static/unchangeable, and the latter can be templated.

I'm fine with keeping this issue and #23 open until after @awalter-bnl is back.