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

Data log every second? #11

Open
Nedsk opened this issue May 2, 2023 · 2 comments
Open

Data log every second? #11

Nedsk opened this issue May 2, 2023 · 2 comments

Comments

@Nedsk
Copy link

Nedsk commented May 2, 2023

Hey,
Sorry to bother.

I have a very simple use I intend for your python app.
I intend to use the app to capture the voltage/current etc every second for while the script is running. I don't need the every ms that it runs today.

is there a simple line I can change to only output one result every second (so my file isn't crazy huge)?
I tried playing around with some lines but unfortunately, couldn't find a simple way to do it.

Thanks!

@baryluk
Copy link
Owner

baryluk commented May 13, 2023

Hi. No, there is no way to control it easily. Hardware can be configured to send less often, but this is not implemented. You need to write own script that postprocesses the file to skip lines. You can just write a Python program, or modify the existing one, and put it in a pipeline.

If you known awk this should be very easy to do quickly.

@baryluk
Copy link
Owner

baryluk commented Nov 14, 2023

@Nedsk In case you do not know how to use awk.

It is common tool on Linux / Unix.

Could use something like this for example:

$ ./fnirsi_logger.py | awk 'BEGIN {next_t=0.0;} { if ($1 >= next_t) { print $0; next_t = $1 + 1.0;} }'
timestamp sample_in_packet voltage_V current_A dp_V dn_V temp_C_ema energy_Ws capacity_As
1700005792.948 0 0.10052 0.00003 1.627 1.525 31.900 0.000000 0.000000
1700005793.948 0 0.10092 0.00003 1.628 1.526 31.900 0.000004 0.000044
1700005794.948 0 0.10095 0.00000 1.628 1.525 31.900 0.000005 0.000048
1700005795.948 0 0.10131 0.00003 1.628 1.526 31.900 0.000007 0.000067
...

Also, the logger now has argument parsers, (currently only have --crc and --verbose options), so if there are more people needing such function, we can easily implement it in the logger, to only print with specific frequency (sub-sampling).

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

2 participants