Using Your Own Software; Example Python Script To Collect A Specified Number Of Readings From The T-1 - Pyramid T-1 User Manual

Web-enabled precision hall probe
Table of Contents

Advertisement

T1 Hall Probe System

10 Using your own software

The web interface of the T-1 allows computers, tablets and phones running different operating
systems to communicate and take data. It also allows simple connection to other software
running on those devices. The JSON format can be used to import data. In Python this could be
done as follows to create a floating point value "vala".
# IP address of T1.
ipaddr =
"192.168.1.135"
t1_ip = "http://"+ipaddr
# Get field data from T1 html server
ra = requests.get(t1_ip+"/io/t1/probe/field/value.json")
# Convert from text to float
vala = ra.json()

10.1 Example Python script to collect a specified number of readings from the T-1

# Import libraries
import
requests
import
time
import
csv
# IP address of T1.
Change as needed.
ipaddr =
"192.168.1.135"
t1_ip =
"http://"
+ ipaddr
# List files for results.
t1_data = []
t1_data_entry = []
# Prompt for number of readings and interval between readings
print
("Capture a set of B field values from the
num =
eval(input("How many readings?
num = min(num,200)
interval =
eval(input("Time interval?
interval = max(interval,0.0003)
print()
T1 User Guide
Change as needed.
# Call to html server - library has to be downloaded
# Timestamps
# csv file handling
T1_data is a list of lists.
"))
# Cap number of readings
"))
# Restrict smallest interval
T1_UG_210314
T1\n")
Page 22 of 42

Advertisement

Table of Contents
loading

Table of Contents