Raise RuntimeError("multiple devices found")

Hello, I’m using the python script – capture_jls.py file on JS220s – to capture the power profile for x amount of time - for automation. It is working OK and outputs the waveform in .jls format. Whenever I want to connect and capture data from 2 Joules using the same script, it gives me the following error:

device = scan_require_one(config=‘auto’)
File “C:\Users\szhaq\AppData\Roaming\Python\Python310\site-packages\joulescope\v1\driver.py”, line 124, in scan_require_one
raise RuntimeError(“multiple devices found”)

Is there a way to select a particular Joule when running the script or/and collect data from both Joules at the same time? How can I change the driver.py script?

I tried printing line 121 from driver.py script and this is the output but I still dont know how to change the script as its the same output for both devices:

Name: None
config auto
devices [<joulescope.v1.js110.DeviceJs110 object at 0x0000027298AA08B0>]

Hi @szhaq and welcome to the Joulescope forum!

You can use the scan function rather than scan_require_one. You would then need to do whatever you want with the list of returned devices.

If you are simply looking to record to jls, you can use the newer pyjoulescope_driver record entry point directly. For example:

python -m pyjoulescope_driver record --serial_number {sn} {out.jls}

For the full list of options, type:

python -m pyjoulescope_driver record --help

Does this make sense? Does either approach work for you?

I totally forgot about capture_all.py, which shows how to use scan. However, capture_all It still records to JLS v1. For JS220, I now strongly recommend using JLS v2, which is just better, more flexible, and much faster to view & navigate in the UI.

A few questions:

  1. Do you have any other requirements other than just recording data to a file?
  2. Do you need synchronization between the captures from each JS220?
  3. Anything else that needs to happen?

Hi @mliberty

Thanks for your reply and confirmation. I used the capture_all.jls file and it works fine with both Joulescopes together

Answering to your questions below:

  1. No other requirements, we want the jls file as well as a cvs file. I can convert the JLS file to CSV easily so no issues there.
  2. We want both the joules to sync data at the same time and at the same sampling rate. I think I set the frequency to 1Mhz and they both are capturing data at that rate.
  3. Nothing else as of now but if there’s something, Ill reach out to you.

Thanks so much for your help and prompt response. You guys have made a great device - cheers!

Great!

For (2), note that while the Joulescopes will capture at approximately the same rate (specified as ±25 ppm each, ±50 ppm combined worst case total), they will not start capturing at exactly the same time. If you are happy with the existing alignment, great!

We will add multiple, simultaneous Joulescope JS220 support to the UI, hopefully by early next year. Part of this work includes improved synchronization between multiple JS220’s.

If you need improved synchronization sooner, the best option is to drive a signal that indicates the region of interest into the INx general-purpose input of each JS220. You can even use a OUTx from one JS220 to drive both INx signals.

Also see:

Great thanks!

So I do have a followup question:

When I was using the capture.py script to get .jls output in a certain directory, after that I was running the following command in the same directory to convert JLS to CVS file and it worked fine:

  1. python -m joulescope recording ‘test123.jls’ --export out.csv

This seems to not work with capture_all.py and it gives the following error:

File “C:\Users\szhaq\AppData\Roaming\Python\Python310\site-packages\joulescope_main_.py”, line 22, in
sys.exit(run())
File “C:\Users\szhaq\AppData\Roaming\Python\Python310\site-packages\joulescope\entry_points\runner.py”, line 105, in run
return args.func(args)
File “C:\Users\szhaq\AppData\Roaming\Python\Python310\site-packages\joulescope\entry_points\recording.py”, line 79, in on_cmd
r = DataReader().open(args.filename)
File “C:\Users\szhaq\AppData\Roaming\Python\Python310\site-packages\joulescope\data_recorder.py”, line 459, in open
self._fh = open(filehandle, ‘rb’)
FileNotFoundError: [Errno 2] No such file or directory: ‘test1_003512’

Any help?

I tried something, but it worked. I am likely not repeating exactly what you did. Here is what I tried:

> cd C:\repos\Jetperch\pyjoulescope_examples\bin
PS C:\repos\Jetperch\pyjoulescope_examples\bin> python .\capture_all.py --frequency 1000000
Capturing data: type CTRL-C to stop
  ... I pressed CTRL-C after about a second to stop the capture ...
PS C:\repos\Jetperch\pyjoulescope_examples\bin> dir *.jls

    Directory: C:\repos\Jetperch\pyjoulescope_examples\bin

Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
-a---           9/27/2023  4:44 PM       25022176 out_000415.jls

PS C:\repos\Jetperch\pyjoulescope_examples\bin> python -m joulescope recording .\out_000415.jls --export out.csv
DataReader 1.67 seconds (1667484 samples)
    sampling_frequency = 1000000
    samples_per_reduction = 20000
    samples_per_tlv = 400000
    samples_per_block = 2000000
PS C:\repos\Jetperch\pyjoulescope_examples\bin>

Note that capture_all adds the serial number to the default output filename, which is why I did the dir *.jls.

What is different from what you did?