Skip to content

Fix time blackrock #1708

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

Merged
merged 5 commits into from
May 14, 2025
Merged

Conversation

luiztauffer
Copy link
Contributor

@luiztauffer luiztauffer commented May 14, 2025

a quick fix for the miliseconds / microseconds part of rec_datetime

@luiztauffer
Copy link
Contributor Author

@zm711 @h-mayorquin found this other error, small but important. We were getting the wrong start recording time (in the miliseconds scale)

@zm711
Copy link
Contributor

zm711 commented May 14, 2025

@luiztauffer could you post an image just of the times before and after? Since I don't know the format it is hard for me to know when to do the factor of 1000 or not?

Or a link to some documentation :)

@h-mayorquin
Copy link
Contributor

h-mayorquin commented May 14, 2025

@zm711

The corresponding description of the NEV header:

image

Here is the spec for the timestamps where you can see that the last two bytes are milliseconds as per the windows convention and we read here:

# basic header
dt0 = [
# Set to "NEURALEV"
("file_type_id", "S8"),
("ver_major", "uint8"),
("ver_minor", "uint8"),
# Flags
("additionnal_flags", "uint16"),
# File index of first data sample
("bytes_in_headers", "uint32"),
# Number of bytes per data packet (sample)
("bytes_in_data_packets", "uint32"),
# Time resolution of time stamps in Hz
("timestamp_resolution", "uint32"),
# Sampling frequency of waveforms in Hz
("sample_resolution", "uint32"),
("year", "uint16"),
("month", "uint16"),
("weekday", "uint16"),
("day", "uint16"),
("hour", "uint16"),
("minute", "uint16"),
("second", "uint16"),
("millisecond", "uint16"),
("application_to_create_file", "S32"),
("comment_field", "S256"),
# Number of extended headers
("nb_ext_headers", "uint32"),
]
nev_basic_header = np.fromfile(filename, count=1, dtype=dt0)[0]

And you can see that the datetime object requieres microseconds here:

https://docs.python.org/3/library/datetime.html#datetime.datetime

Copy link
Contributor

@h-mayorquin h-mayorquin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Contributor

@zm711 zm711 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool thanks I didn't realize datetime needed the microseconds. Sorry read too fast :)

@zm711 zm711 merged commit 43f2c36 into NeuralEnsemble:master May 14, 2025
5 checks passed
@luiztauffer luiztauffer deleted the fix-time-blackrock branch May 15, 2025 10:24
@zm711 zm711 added this to the 0.14.2 milestone May 15, 2025
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

Successfully merging this pull request may close these issues.

3 participants