Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot convert `hdr.start['time'] using the specified format #21

Open
EliotGann opened this issue Mar 21, 2019 · 0 comments
Open

Cannot convert `hdr.start['time'] using the specified format #21

EliotGann opened this issue Mar 21, 2019 · 0 comments

Comments

@EliotGann
Copy link

Observed at SST-2/RSOXS by @mrakitin and @awalter-bnl. The issue is created by @mrakitin.

In [75]: tiff_series.export(db[-1].documents(fill=True), file_prefix='{start[institution]}-{start[time]:%Y-%m-%d_%H-%M}-', directory=os.getcwd())
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-75-1cb6645c4b01> in <module>
----> 1 tiff_series.export(db[-1].documents(fill=True), file_prefix='{start[institution]}-{start[time]:%Y-%m-%d_%H-%M}-', directory=os.getcwd())

c:\users\greateyes\appdata\local\conda\conda\envs\collection-2019-1.2-rsoxs\lib\site-packages\suitcase\tiff_series\__init__.py in export(gen, directory, file_prefix, bigtiff, byteorder, imagej, **kwargs)
     99                     **kwargs) as serializer:
    100         for item in gen:
--> 101             serializer(*item)
    102
    103     return serializer.artifacts

c:\users\greateyes\appdata\local\conda\conda\envs\collection-2019-1.2-rsoxs\lib\site-packages\event_model\__init__.py in __call__(self, name, doc, validate)
     69             instance as doc, a copy of doc, or a different dict altogether.
     70         """
---> 71         output_doc = getattr(self, name)(doc)
     72         if validate:
     73             jsonschema.validate(output_doc,

c:\users\greateyes\appdata\local\conda\conda\envs\collection-2019-1.2-rsoxs\lib\site-packages\suitcase\tiff_series\__init__.py in event(self, doc)
    219                 self._templated_file_prefix = self._file_prefix.format(
    220                     start=self._start, descriptor=descriptor,
--> 221                     event=doc)
    222                 num = next(self._counter[streamname][field])
    223                 filename = (f'{self._templated_file_prefix}'

ValueError: Invalid format specifier

It turns out that hdr.start['time'] is a float, and it's not possible to convert a float to the datetime object, and then format it to a string.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant