Hi, I use a JS220 with the capture_jls_v2.py file from the examples.
Now i need to extract the minVoltage.
Is it possible to read this value directly from the device after recording or just opening the jls file and get the minVoltage value ?
I am not very confirm with python, very thankfull for any help
The JS220 does not store the statistics over the recording, but it is very easy to open the JLS file to get the minimum voltage.
Here is a Python script that opens the JLS file and gets the minimum voltage over the entire capture:
# Copyright 2024 Jetperch LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from pyjls import Reader, SummaryFSR
import argparse
import sys
def get_parser():
p = argparse.ArgumentParser(
description='.')
p.add_argument('--verbose', '-v',
action='store_true',
help='Display verbose information.')
p.add_argument('infile',
help='JLS input filename')
return p
def run():
args = get_parser().parse_args()
with Reader(args.infile) as r:
try:
signal = r.signal_lookup('voltage')
except ValueError:
print('Could not find voltage signal.')
return 1
data = r.fsr_statistics(signal.signal_id, 0, signal.length, 1)
print(f'voltage min = {data[0, SummaryFSR.MIN]} V')
if __name__ == '__main__':
sys.exit(run())
If you save this to a file jls_voltage_min.py, then you run the script like this: