annotate rs_fsp7_logmarker.py @ 78:47da95b31dcb

Move sifmt function to where it can be reused.
author Daniel O'Connor <doconnor@gsoft.com.au>
date Fri, 27 Sep 2024 16:50:42 +0930
parents b6ebe05f250f
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
74
b6ebe05f250f Add some commentry about what it works with
Daniel O'Connor <doconnor@gsoft.com.au>
parents:
diff changeset
1 #!/usr/bin/env python3
b6ebe05f250f Add some commentry about what it works with
Daniel O'Connor <doconnor@gsoft.com.au>
parents:
diff changeset
2
b6ebe05f250f Add some commentry about what it works with
Daniel O'Connor <doconnor@gsoft.com.au>
parents:
diff changeset
3 # Copyright (c) 2023
b6ebe05f250f Add some commentry about what it works with
Daniel O'Connor <doconnor@gsoft.com.au>
parents:
diff changeset
4 # Daniel O'Connor <darius@dons.net.au>. All rights reserved.
b6ebe05f250f Add some commentry about what it works with
Daniel O'Connor <doconnor@gsoft.com.au>
parents:
diff changeset
5 #
b6ebe05f250f Add some commentry about what it works with
Daniel O'Connor <doconnor@gsoft.com.au>
parents:
diff changeset
6 # Redistribution and use in source and binary forms, with or without
b6ebe05f250f Add some commentry about what it works with
Daniel O'Connor <doconnor@gsoft.com.au>
parents:
diff changeset
7 # modification, are permitted provided that the following conditions
b6ebe05f250f Add some commentry about what it works with
Daniel O'Connor <doconnor@gsoft.com.au>
parents:
diff changeset
8 # are met:
b6ebe05f250f Add some commentry about what it works with
Daniel O'Connor <doconnor@gsoft.com.au>
parents:
diff changeset
9 # 1. Redistributions of source code must retain the above copyright
b6ebe05f250f Add some commentry about what it works with
Daniel O'Connor <doconnor@gsoft.com.au>
parents:
diff changeset
10 # notice, this list of conditions and the following disclaimer.
b6ebe05f250f Add some commentry about what it works with
Daniel O'Connor <doconnor@gsoft.com.au>
parents:
diff changeset
11 # 2. Redistributions in binary form must reproduce the above copyright
b6ebe05f250f Add some commentry about what it works with
Daniel O'Connor <doconnor@gsoft.com.au>
parents:
diff changeset
12 # notice, this list of conditions and the following disclaimer in the
b6ebe05f250f Add some commentry about what it works with
Daniel O'Connor <doconnor@gsoft.com.au>
parents:
diff changeset
13 # documentation and/or other materials provided with the distribution.
b6ebe05f250f Add some commentry about what it works with
Daniel O'Connor <doconnor@gsoft.com.au>
parents:
diff changeset
14 #
b6ebe05f250f Add some commentry about what it works with
Daniel O'Connor <doconnor@gsoft.com.au>
parents:
diff changeset
15 # THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
b6ebe05f250f Add some commentry about what it works with
Daniel O'Connor <doconnor@gsoft.com.au>
parents:
diff changeset
16 # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
b6ebe05f250f Add some commentry about what it works with
Daniel O'Connor <doconnor@gsoft.com.au>
parents:
diff changeset
17 # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
b6ebe05f250f Add some commentry about what it works with
Daniel O'Connor <doconnor@gsoft.com.au>
parents:
diff changeset
18 # ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
b6ebe05f250f Add some commentry about what it works with
Daniel O'Connor <doconnor@gsoft.com.au>
parents:
diff changeset
19 # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
b6ebe05f250f Add some commentry about what it works with
Daniel O'Connor <doconnor@gsoft.com.au>
parents:
diff changeset
20 # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
b6ebe05f250f Add some commentry about what it works with
Daniel O'Connor <doconnor@gsoft.com.au>
parents:
diff changeset
21 # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
b6ebe05f250f Add some commentry about what it works with
Daniel O'Connor <doconnor@gsoft.com.au>
parents:
diff changeset
22 # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
b6ebe05f250f Add some commentry about what it works with
Daniel O'Connor <doconnor@gsoft.com.au>
parents:
diff changeset
23 # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
b6ebe05f250f Add some commentry about what it works with
Daniel O'Connor <doconnor@gsoft.com.au>
parents:
diff changeset
24 # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
b6ebe05f250f Add some commentry about what it works with
Daniel O'Connor <doconnor@gsoft.com.au>
parents:
diff changeset
25 # SUCH DAMAGE.
b6ebe05f250f Add some commentry about what it works with
Daniel O'Connor <doconnor@gsoft.com.au>
parents:
diff changeset
26 #
b6ebe05f250f Add some commentry about what it works with
Daniel O'Connor <doconnor@gsoft.com.au>
parents:
diff changeset
27
b6ebe05f250f Add some commentry about what it works with
Daniel O'Connor <doconnor@gsoft.com.au>
parents:
diff changeset
28 import rsib
b6ebe05f250f Add some commentry about what it works with
Daniel O'Connor <doconnor@gsoft.com.au>
parents:
diff changeset
29 import time
b6ebe05f250f Add some commentry about what it works with
Daniel O'Connor <doconnor@gsoft.com.au>
parents:
diff changeset
30
b6ebe05f250f Add some commentry about what it works with
Daniel O'Connor <doconnor@gsoft.com.au>
parents:
diff changeset
31 if __name__ == '__main__':
b6ebe05f250f Add some commentry about what it works with
Daniel O'Connor <doconnor@gsoft.com.au>
parents:
diff changeset
32 r = rsib.RSIBDevice('analyzer')
b6ebe05f250f Add some commentry about what it works with
Daniel O'Connor <doconnor@gsoft.com.au>
parents:
diff changeset
33
b6ebe05f250f Add some commentry about what it works with
Daniel O'Connor <doconnor@gsoft.com.au>
parents:
diff changeset
34 # ID instrument
b6ebe05f250f Add some commentry about what it works with
Daniel O'Connor <doconnor@gsoft.com.au>
parents:
diff changeset
35 r.write('*IDN?')
b6ebe05f250f Add some commentry about what it works with
Daniel O'Connor <doconnor@gsoft.com.au>
parents:
diff changeset
36 print("ID is " + r.read(5).decode('ascii'))
b6ebe05f250f Add some commentry about what it works with
Daniel O'Connor <doconnor@gsoft.com.au>
parents:
diff changeset
37
b6ebe05f250f Add some commentry about what it works with
Daniel O'Connor <doconnor@gsoft.com.au>
parents:
diff changeset
38 while True:
b6ebe05f250f Add some commentry about what it works with
Daniel O'Connor <doconnor@gsoft.com.au>
parents:
diff changeset
39 r.write('CALC1:MARK1:Y?')
b6ebe05f250f Add some commentry about what it works with
Daniel O'Connor <doconnor@gsoft.com.au>
parents:
diff changeset
40 print(r.read(5).decode('ascii'))
b6ebe05f250f Add some commentry about what it works with
Daniel O'Connor <doconnor@gsoft.com.au>
parents:
diff changeset
41 time.sleep(1)
b6ebe05f250f Add some commentry about what it works with
Daniel O'Connor <doconnor@gsoft.com.au>
parents:
diff changeset
42