Comments (6)
the problem seems to be with the seconds
wait a minut the code contain this
def from_isotime(text, use_tz=False):
"""
@param text: string representing the time is iso format
"""
text = str(text)
base = text[:19]
if use_tz and len(text) == 25:
sgn = 1 if text[:19] == "+" else -1
tz = 60 * (60 * int(text[20:22]) + int(text[23:25])) * sgn
else:
tz = 0
return time.mktime(time.strptime(base, "%Y-%m-%dT%H:%M:%S")) + tz
but the len of the time data is ['2016-03-23T12:01: = 19
strange data format.
from fabio.
Here the information taken from hdfview
start_time (8760, 2)
String, length = 24, 1
Number of attributes = 1
description = Starting time of measurement
the content is
2016-03-23T12:01:28+0100
from fabio.
text before and after str(text)
['2016-03-23T12:01:28+0100']
['2016-03-23T12:01:28+0100']
This is an array of string
from fabio.
In [1]: from dateutil.parser import parse
In [2]: parse('2016-03-23T12:01:28+0100')
datetime.datetime(2016, 3, 23, 12, 1, 28, tzinfo=tzoffset(None, 3600))
maybe the right things to do is to use datetime on the string
from fabio.
When extracted with h5py, I get an array of string
In [8]: f['scan_27/start_time']
Out[8]: <HDF5 dataset "start_time": shape (1,), type "|S24">
but it seems that the value given to the from_isotime function is the string equivalent of the array
In [14]: str(f['scan_27/start_time'][:])
Out[14]: "['2016-03-23T12:01:28+0100']"
from fabio.
Hi Fred,
The problem comes from the "start_time" which is not a string but an array of strings.
"['2016-03-23T12:01:28+0100']" is not '2016-03-23T12:01:28+0100'
Dateutil looks nice but it is an additional dependency ...
I will fix the issue in "nexus" directly
from fabio.
Related Issues (20)
- Support mask fileformat used in CrysalisPro HOT 2
- Low test coverage
- Include man-pages into online documentation
- Support Python 3.11 and Cython3
- checksum mismatch for small CBF files HOT 1
- Cannot read cbf images in latest fabio versions HOT 1
- WARNING:fabio.TiffIO:Data at tag id '65000' is smaller than expected HOT 4
- which runtime dependencies for fabio HOT 1
- ValueError: array to be byte-swapped is read-only HOT 4
- [meson] source distribution files have no timestamps HOT 3
- [TIFF] Management of multi-frame tiff HOT 3
- Broken tests in python 3.12 HOT 2
- Build issue since moving fabio to src HOT 7
- cannot read marccd image HOT 1
- Several regression in Python3.12 ... related to unclosed gzip files
- Move to pydata sphinx theme
- Support for newer GE files? HOT 10
- Compatibility with numpy 2.0
- Support sparse format from XPCS data ... HOT 1
- Compatibility with `numpy2` (bis) HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from fabio.