Hello,
I want to add some annotations during capturing data and see these annotation in UI. For example I can mark my data with different states of my device: boot, idle, active and etc. I didn’t find any samples in pyjoulescope_examples project. Can I enrich data using JlsWriter or I have to use callback and insert all data by myself?
Hi @Victor and welcome to the Joulescope forum!
I think the best example of adding annotations is the pyjls annotation entry point . This generates random annotations just to show that the annotation feature works. Dual markers are the anno_type == 3
case. The UI identifies dual markers by the naming convention.
See the Writer.annotation
method documentation.
The Joulescope UI uses group_id
for TEXT annotations to denote the shape. See jls_v2_annotations.jls to see how the UI loads these annotations.
The JlsWriter
class has no support for annotations. You can access the Writer
instance using the JlsWriter._wr
member.
How are you identifying the time at which these annotations should be added? Are you inspecting the incoming Joulescope data? Based upon some other channel?
Another option is to record the {filename}.jls
file as normal, and then create a separate {filename}.anno.jls
file that contains the annotations. You can open {filename}.jls
and use the Reader.timestamp_to_sample_id
method to map UTC time to the sample_id so that you can create the annotation JLS.
A totally different approach is to drive general purpose outputs from your microcontroller to indicate the state and connect them to the IN 0 through 3 on the JS220. You can then record these inputs along with the data. The IN signals are not supported by JlsWriter
. You can use the pyjoulescope_driver
record
entry point, like this:
python -m pyjoulescope_driver record --signal i,v,p,0,1,2,3 out.jls
Does this make sense and answer your question?
Hi @mliberty !
Thank you very much for your answer ! It allows me to move forward. I will learn your samples and return with the results
In my case I receive the markers from the debug serial port of my device (I use raspberry to connect joulescope and my device).
As variant I can connect raspberry GPIO to IN 0…3 on the JS220 and based on serial port data put signals on the JS220. Thank you for the option!
I want to clarify - does Joulescope UI combine {filename}.jls and {filename}.anno.jls into one window or I have to open them as two files?
Yes, the Joulescope UI automatically searches for all {filename}.anno*.jls
in the same path as {filename}.jls
and loads the annotations from those files automatically.
We also have issue #153 which adds UART decoding and text display to the Joulescope UI. When we finally implement this, it would automate exactly what you are trying to do.
Out of curiousity, what are your UART settings: baud rate, parity, and stop bit?
Wow! It could definitely help for such kind of use cases.
My device sends to the UART different debug messages and some of them could announce different phases of power consumption (for example: switch to idle, start network communication, measurement and so on).
Now I have an idea to mark these phases as dual markers (start-stop). And I’m not sure that mapping all of such message to IN0…3 will be enough.
In my case I use UART with baud rate: 115200, parity: none, stopbit: 1, databits: 8.
Hello @mliberty
I managed to record data and add annotations based on pyjoulescope_driver/record.py and pyjls/entry_points/annotate.py.
Only one thing: if I add annotations in the main file, the UI doesn’t show any markers. It only works when I add annotations to a separate file ({file}.anno.jls). Is this by design, or did I do something incorrectly?
Thank you for your help and happy new year!
Hi @Victor - I thought that the UI loaded annotations from the main JLS file, but I can say that this is not a feature we test. I inspected the code, and it looks like the UI has not supported annotation load from the main JLS file, at least not for over a year. I created issue #299.
The fix is done and will be part of the next UI release. For the time being, can you use a separate {base}.anno*.jls
or run the UI from source? If not, let me know and we can create an alpha release build for you to use.
Hi @mliberty !
I even didn’t expect so fast response and even fix - thanks!
For me using separate file is totally Ok and I will wait for official release of the UI.