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

Annotation load not working #283

Closed
mliberty1 opened this issue Jul 31, 2024 · 1 comment
Closed

Annotation load not working #283

mliberty1 opened this issue Jul 31, 2024 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@mliberty1
Copy link
Member

Joulescope model

JS220

UI version

1.1.9

What OS are you seeing the problem on?

Windows 11

What happened?

I saved annotations alongside a JLS file. When I reload the JLS file, only the text annotations load.
anno

What was expected?

The x-axis markers should also load.

How to reproduce?

See GIF above.

Extra information

No response

@mliberty1 mliberty1 added bug Something isn't working triage New issue that needs to be reviewed and prioritized labels Jul 31, 2024
@mliberty1 mliberty1 self-assigned this Jul 31, 2024
@mliberty1 mliberty1 removed the triage New issue that needs to be reviewed and prioritized label Jul 31, 2024
@plat-zhaw
Copy link

Hi,

I'm also having this issue on Ubuntu 22.04.5 LTS. The double coursers I added are not showing up. When I open Widgets > Notes I get an empty window, but I added some description of the signals when I saved the measurement. I also get a lot of exceptions when I open a file with annotations:

plat@6674:~/Documents/light_int_lvl_sens/measurements/led_vsly5850_pt_1540052na3090/water$ joulescope
*****************************
* Joulescope User Interface *
* UI Version = 1.1.10       *
*****************************

info = {
  "joulescope": {
    "ui_version": "1.1.10"
  },
  "platform": {
    "name": "linux",
    "python_version": "3.10.12 (main, Jul 29 2024, 16:56:48) [GCC 11.4.0]",
    "platform": "Linux-6.8.0-40-generic-x86_64-with-glibc2.35",
    "processor": "x86_64",
    "executable": "/usr/bin/python3",
    "is_release": false
  }
}

=====
WARNING:2024-09-12 09:26:08,721:reader.c:414:pyjls.c:invalid start_sample_id: -21130313132981
ERROR:2024-09-12 09:26:08,721:jls_source.py:160:joulescope_ui.jls_source:During jls process
Traceback (most recent call last):
  File "/home/plat/.local/lib/python3.10/site-packages/joulescope_ui/jls_source.py", line 152, in run
    cmd, value = self._queue.get(timeout=timeout)
  File "/usr/lib/python3.10/queue.py", line 179, in get
    raise Empty
_queue.Empty

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/plat/.local/lib/python3.10/site-packages/joulescope_ui/jls_source.py", line 157, in run
    rsp = self._jls.process(value)
  File "/home/plat/.local/lib/python3.10/site-packages/joulescope_ui/jls_v2.py", line 202, in process
    data = self._jls.fsr_statistics(signal_id, start, increment, length)
  File "pyjls/binding.pyx", line 758, in pyjls.binding.Reader.fsr_statistics
  File "pyjls/binding.pyx", line 269, in pyjls.binding._handle_rc
RuntimeError: rd_fsr_statistics PARAMETER_INVALID[5]: The parameter value is invalid
WARNING:2024-09-12 09:26:08,721:reader.c:414:pyjls.c:invalid start_sample_id: -21130313132981
ERROR:2024-09-12 09:26:08,721:jls_source.py:160:joulescope_ui.jls_source:During jls process
Traceback (most recent call last):
  File "/home/plat/.local/lib/python3.10/site-packages/joulescope_ui/jls_source.py", line 152, in run
    cmd, value = self._queue.get(timeout=timeout)
  File "/usr/lib/python3.10/queue.py", line 179, in get
    raise Empty
_queue.Empty

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/plat/.local/lib/python3.10/site-packages/joulescope_ui/jls_source.py", line 157, in run
    rsp = self._jls.process(value)
  File "/home/plat/.local/lib/python3.10/site-packages/joulescope_ui/jls_v2.py", line 202, in process
    data = self._jls.fsr_statistics(signal_id, start, increment, length)
  File "pyjls/binding.pyx", line 758, in pyjls.binding.Reader.fsr_statistics
  File "pyjls/binding.pyx", line 269, in pyjls.binding._handle_rc
RuntimeError: rd_fsr_statistics PARAMETER_INVALID[5]: The parameter value is invalid
WARNING:2024-09-12 09:26:08,721:reader.c:414:pyjls.c:invalid start_sample_id: -21130313132981
ERROR:2024-09-12 09:26:08,721:jls_source.py:160:joulescope_ui.jls_source:During jls process
Traceback (most recent call last):
  File "/home/plat/.local/lib/python3.10/site-packages/joulescope_ui/jls_source.py", line 152, in run
    cmd, value = self._queue.get(timeout=timeout)
  File "/usr/lib/python3.10/queue.py", line 179, in get
    raise Empty
_queue.Empty

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/plat/.local/lib/python3.10/site-packages/joulescope_ui/jls_source.py", line 157, in run
    rsp = self._jls.process(value)
  File "/home/plat/.local/lib/python3.10/site-packages/joulescope_ui/jls_v2.py", line 202, in process
    data = self._jls.fsr_statistics(signal_id, start, increment, length)
  File "pyjls/binding.pyx", line 758, in pyjls.binding.Reader.fsr_statistics
  File "pyjls/binding.pyx", line 269, in pyjls.binding._handle_rc
RuntimeError: rd_fsr_statistics PARAMETER_INVALID[5]: The parameter value is invalid
WARNING:2024-09-12 09:26:08,721:reader.c:414:pyjls.c:invalid start_sample_id: -21130313132981
ERROR:2024-09-12 09:26:08,721:jls_source.py:160:joulescope_ui.jls_source:During jls process
Traceback (most recent call last):
  File "/home/plat/.local/lib/python3.10/site-packages/joulescope_ui/jls_source.py", line 152, in run
    cmd, value = self._queue.get(timeout=timeout)
  File "/usr/lib/python3.10/queue.py", line 179, in get
    raise Empty
_queue.Empty

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/plat/.local/lib/python3.10/site-packages/joulescope_ui/jls_source.py", line 157, in run
    rsp = self._jls.process(value)
  File "/home/plat/.local/lib/python3.10/site-packages/joulescope_ui/jls_v2.py", line 202, in process
    data = self._jls.fsr_statistics(signal_id, start, increment, length)
  File "pyjls/binding.pyx", line 758, in pyjls.binding.Reader.fsr_statistics
  File "pyjls/binding.pyx", line 269, in pyjls.binding._handle_rc
RuntimeError: rd_fsr_statistics PARAMETER_INVALID[5]: The parameter value is invalid
Traceback (most recent call last):
  File "/home/plat/.local/lib/python3.10/site-packages/joulescope_ui/widget_tools.py", line 64, in _on_triggered
    self._fn(checked)
  File "/home/plat/.local/lib/python3.10/site-packages/joulescope_ui/main.py", line 142, in <lambda>
    return lambda checked=False: pubsub_singleton.publish(*value)
  File "/home/plat/.local/lib/python3.10/site-packages/joulescope_ui/pubsub.py", line 605, in publish
    return self._send(cmd, defer=defer)
  File "/home/plat/.local/lib/python3.10/site-packages/joulescope_ui/pubsub.py", line 514, in _send
    return self._process(cmd)
  File "/home/plat/.local/lib/python3.10/site-packages/joulescope_ui/pubsub.py", line 951, in _process
    self._process_inner(cmd)
  File "/home/plat/.local/lib/python3.10/site-packages/joulescope_ui/pubsub.py", line 922, in _process_inner
    return_value = cmds_update_fn[0](self, topic, value)
  File "/home/plat/.local/lib/python3.10/site-packages/joulescope_ui/pubsub_callable.py", line 71, in __call__
    return self._fn(pubsub, topic, value)
  File "/home/plat/.local/lib/python3.10/site-packages/joulescope_ui/widgets/report_issue/report_issue_dialog.py", line 49, in on_cls_action_show
    dialog = ReportIssueDialog(value)
  File "/home/plat/.local/lib/python3.10/site-packages/joulescope_ui/widgets/report_issue/report_issue_dialog.py", line 28, in __init__
    path = reporter.create('user')
  File "/home/plat/.local/lib/python3.10/site-packages/joulescope_ui/reporter.py", line 173, in create
    d = datetime.datetime.now(datetime.UTC)
AttributeError: module 'datetime' has no attribute 'UTC'
Traceback (most recent call last):
  File "/home/plat/.local/lib/python3.10/site-packages/joulescope_ui/widget_tools.py", line 64, in _on_triggered
    self._fn(checked)
  File "/home/plat/.local/lib/python3.10/site-packages/joulescope_ui/main.py", line 142, in <lambda>
    return lambda checked=False: pubsub_singleton.publish(*value)
  File "/home/plat/.local/lib/python3.10/site-packages/joulescope_ui/pubsub.py", line 605, in publish
    return self._send(cmd, defer=defer)
  File "/home/plat/.local/lib/python3.10/site-packages/joulescope_ui/pubsub.py", line 514, in _send
    return self._process(cmd)
  File "/home/plat/.local/lib/python3.10/site-packages/joulescope_ui/pubsub.py", line 951, in _process
    self._process_inner(cmd)
  File "/home/plat/.local/lib/python3.10/site-packages/joulescope_ui/pubsub.py", line 922, in _process_inner
    return_value = cmds_update_fn[0](self, topic, value)
  File "/home/plat/.local/lib/python3.10/site-packages/joulescope_ui/pubsub_callable.py", line 71, in __call__
    return self._fn(pubsub, topic, value)
  File "/home/plat/.local/lib/python3.10/site-packages/joulescope_ui/widgets/report_issue/report_issue_dialog.py", line 49, in on_cls_action_show
    dialog = ReportIssueDialog(value)
  File "/home/plat/.local/lib/python3.10/site-packages/joulescope_ui/widgets/report_issue/report_issue_dialog.py", line 28, in __init__
    path = reporter.create('user')
  File "/home/plat/.local/lib/python3.10/site-packages/joulescope_ui/reporter.py", line 173, in create
    d = datetime.datetime.now(datetime.UTC)
AttributeError: module 'datetime' has no attribute 'UTC'

So I had a look at the file using pyjls:

plat@6674:~/Documents/light_int_lvl_sens/measurements/led_vsly5850_pt_1540052na3090/water$ pyjls info vce_5v_if_100ua_dark_to_on_24mm.jls
Sources:
    0: global_annotation_source
    1: JS220-000185
Signals:
    0: 0.global_annotation_signal
    1: 1.current (1495575 samples at 100000 Hz)
    2: 1.voltage (1495575 samples at 100000 Hz)
    3: 1.power (1495575 samples at 100000 Hz)
    4: 1.current_range (29911040 samples at 2000000 Hz)
User Data:
    0: Recorded signals:
- Current: PT 1540052NA3090 collector current ...

This looks to me like the annotations are still there. So I decided to see if I can recover the information, assuming it's still there. So I wrote the following code:

import pyjls as jls

# Relative path to directory containing water measurements
water_dir = 'led_vsly5850_pt_1540052na3090/water'
# File names
jsl_file = 'vce_5v_if_100ua_dark_to_on_24mm.jls'
anno_file = 'vce_5v_if_100ua_dark_to_on_24mm.anno.jls'

def user_data_cbk(chunk_meta_u16, data) -> bool:
    """Callback function for pyjls.Reader.user_data method."""
    print('chunk_meta_u16:', chunk_meta_u16)
    print('data:')
    print(data)
    return False

def annotation_cbk(timestamp, y, annotation_type, group_id, data) -> bool:
    """Callback function for pyjls.Reader.annotations method."""
    print('timestamp:', timestamp)
    print('y:', y)
    print('annotation_type:', annotation_type)
    print('group_id:', group_id)
    print('data:', data)
    return False

def jls_file_info(file_path: str) -> None:
    """Prints Joulescope file infos.
    
    Args:
        file_path (str): Path to Joulescope file.
    """
    print(file_path + ':')
    print('='*(len(file_path) + 1))
    with jls.Reader(file_path) as r:
        # Print the signals
        print('\nSignals:')
        print('--------')
        for k, v in r.signals.items():
            print(f'{k}: {v}')
        # Print the sources
        print('\nSources:')
        print('--------')
        for k, v in r.sources.items():
            print(f'{k}: {v}')
        # Print the user data
        print('\nUser data:')
        print('----------')
        r.user_data(user_data_cbk)
        # Print annotations
        print('\nAnnotations:')
        print('------------')
        for k in r.signals:
            r.annotations(k, 0, annotation_cbk)

# Print file infos
jls_file_info(water_dir + '/' + jsl_file)
print('\n\n')
jls_file_info(water_dir + '/' + anno_file)

I ran the script and got the following output:

led_vsly5850_pt_1540052na3090/water/vce_5v_if_100ua_dark_to_on_24mm.jls:
========================================================================

Signals:
--------
0: SignalDef(signal_id=0, source_id=0, signal_type=1, data_type=8196, sample_rate=0, samples_per_data=16, sample_decimate_factor=16, entries_per_summary=10, summary_decimate_factor=10, annotation_decimate_factor=100, utc_decimate_factor=100, sample_id_offset=0, name='global_annotation_signal', units='', length=0)
1: SignalDef(signal_id=1, source_id=1, signal_type=0, data_type=8196, sample_rate=100000, samples_per_data=8192, sample_decimate_factor=128, entries_per_summary=640, summary_decimate_factor=20, annotation_decimate_factor=100, utc_decimate_factor=100, sample_id_offset=0, name='current', units='A', length=1495575)
2: SignalDef(signal_id=2, source_id=1, signal_type=0, data_type=8196, sample_rate=100000, samples_per_data=8192, sample_decimate_factor=128, entries_per_summary=640, summary_decimate_factor=20, annotation_decimate_factor=100, utc_decimate_factor=100, sample_id_offset=0, name='voltage', units='V', length=1495575)
3: SignalDef(signal_id=3, source_id=1, signal_type=0, data_type=8196, sample_rate=100000, samples_per_data=8192, sample_decimate_factor=128, entries_per_summary=640, summary_decimate_factor=20, annotation_decimate_factor=100, utc_decimate_factor=100, sample_id_offset=0, name='power', units='W', length=1495575)
4: SignalDef(signal_id=4, source_id=1, signal_type=0, data_type=1027, sample_rate=2000000, samples_per_data=65536, sample_decimate_factor=1024, entries_per_summary=1280, summary_decimate_factor=20, annotation_decimate_factor=100, utc_decimate_factor=100, sample_id_offset=0, name='current_range', units='', length=29911040)

Sources:
--------
0: SourceDef(source_id=0, name='global_annotation_source', vendor='jls', model='-', version='1.0.0', serial_number='-')
1: SourceDef(source_id=1, name='JS220-000185', vendor='Jetperch LLC', model='JS220', version='{"hw": "1", "fw": "1.2.1", "fpga": "1.2.1"}', serial_number='000185')

User data:
----------
chunk_meta_u16: 0
data:
Recorded signals:
- Current: PT 1540052NA3090 collector current $i_C$
- Voltage: PT 1540052NA3090 collector-emitter voltage $v_{CE}$
- Power
- Range

When LED VSLY5850  on: $I_F$ = 99.5 uA @ $V_F$ = 1.18 V

Annotations:
------------



led_vsly5850_pt_1540052na3090/water/vce_5v_if_100ua_dark_to_on_24mm.anno.jls:
=============================================================================

Signals:
--------
0: SignalDef(signal_id=0, source_id=0, signal_type=1, data_type=8196, sample_rate=0, samples_per_data=16, sample_decimate_factor=16, entries_per_summary=10, summary_decimate_factor=10, annotation_decimate_factor=100, utc_decimate_factor=100, sample_id_offset=0, name='global_annotation_signal', units='', length=0)
1: SignalDef(signal_id=1, source_id=1, signal_type=0, data_type=8196, sample_rate=1000000, samples_per_data=8192, sample_decimate_factor=128, entries_per_summary=640, summary_decimate_factor=20, annotation_decimate_factor=100, utc_decimate_factor=100, sample_id_offset=0, name='current', units='A', length=0)
2: SignalDef(signal_id=2, source_id=1, signal_type=0, data_type=8196, sample_rate=1000000, samples_per_data=8192, sample_decimate_factor=128, entries_per_summary=640, summary_decimate_factor=20, annotation_decimate_factor=100, utc_decimate_factor=100, sample_id_offset=0, name='voltage', units='V', length=0)
3: SignalDef(signal_id=3, source_id=1, signal_type=0, data_type=8196, sample_rate=1000000, samples_per_data=8192, sample_decimate_factor=128, entries_per_summary=640, summary_decimate_factor=20, annotation_decimate_factor=100, utc_decimate_factor=100, sample_id_offset=0, name='power', units='W', length=0)
4: SignalDef(signal_id=4, source_id=1, signal_type=0, data_type=8196, sample_rate=1000000, samples_per_data=8192, sample_decimate_factor=128, entries_per_summary=640, summary_decimate_factor=20, annotation_decimate_factor=100, utc_decimate_factor=100, sample_id_offset=0, name='current_range', units='', length=0)

Sources:
--------
0: SourceDef(source_id=0, name='global_annotation_source', vendor='jls', model='-', version='1.0.0', serial_number='-')
1: SourceDef(source_id=1, name='annotations', vendor='-', model='-', version='-', serial_number='-')

User data:
----------

Annotations:
------------
timestamp: 75462
y: None
annotation_type: 2
group_id: 0
data: 1a
timestamp: 7073894
y: None
annotation_type: 2
group_id: 0
data: 1b
timestamp: 7569600
y: None
annotation_type: 2
group_id: 0
data: 2a
timestamp: 14574538
y: None
annotation_type: 2
group_id: 0
data: 2b

So the information is definitly still there (though I did not check if the courser location (timestamp) is correct). Hope this helps a little.

Regards, Immanuel

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
No open projects
Development

No branches or pull requests

2 participants