SPIDAR SDK
69
5.4.4 Reading Data
In SDK mode, data is not saved on the NIC-500. Data is pushed over a network socket to the
client which must read the data from the buffer. If power to the NIC-500 is lost then all of the
data in the buffer is forgotten, and if the buffer is filled, the earliest traces will be overwritten. For
these reasons we strongly recommend running a script to read data from the system while the
system is collecting.
The first thing you must do is open the data socket:
ret=requests.get("http://192.168.20.221:8080/api/nic/gpr/data_socket")
This command will return information on the data socket including the port number. You must
then open a socket on this port, the following example uses Python socket library:
data_channel = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
data_channel.connect((“192.168.20.221”, 8090))
Once the data channel is connected the data must be received. The data is sent from the buffer
in bytes so it must be converted to be readable. Each trace consists of a 20-byte header
followed by the trace data, which writes each sample point as a 4-byte floating point amplitude
in mV. The header contains information such as a time stamp, the trace number, number of
stacks etc. The total length of a single trace (in bytes) then is 4 × points per trace + 20. In our
example one trace is 820 bytes. The following code reads in a single trace and converts it to a
readable format:
data = data_channel.recv(820)
(tv_sec, tv_nsec, trace_num, status, stacks, header_size), s =
struct.unpack('<LLLLHH', data[0:20]),data[20:]
trace = numpy.frombuffer(s, dtype=numpy.float32)
The first line receives the bytes from the buffer over the data channel. The second and third
lines split the received data into the header (in brackets, from left to right: the time of collection
in seconds, time of collection in ns, the trace number, the status of the trace, the number of
stacks in the trace and the size of the header) and the trace amplitude data (held in the variable
s). The final line converts the trace amplitude data from bytes to an array of numbers.
5.5 Troubleshooting
Refer to the sample code provided when programming SDK, this may give you a starting point,
and something to build on.
If you believe the system is not operating properly, turn off SDK mode and see if normal
operation resumes. If it does, then there is possibly something in your SDK commands which is
affecting operation.
Содержание SPIDAR NIC-500s
Страница 1: ......
Страница 2: ...ii...
Страница 4: ...Warranty Confirmation iv...
Страница 6: ...vi...
Страница 10: ...Introduction 2...
Страница 28: ...Getting Started 20...
Страница 66: ...SPIDAR Software 58...
Страница 78: ...SPIDAR SDK 70...
Страница 88: ...Compatibility 80...
Страница 90: ...Technical Specifications 82...
Страница 94: ...Appendix B Components 86 Item Item Code Noggin Cable 10m 100 52 0050 Noggin Cable 30m 100 52 0062...
Страница 102: ...Appendix D GPR Knowledge 94...
Страница 106: ...Appendix F Health Safety Certification 98...
Страница 114: ...Appendix G GPR Emissions Interference and Regulations 106...
Страница 116: ...Appendix H Instrument Interference 108...
Страница 118: ...Appendix I Safety around Explosive Devices 110...