Commit 97291323 authored by Rémi's avatar Rémi
Browse files

new function export to bert

No related merge requests found
Showing with 112 additions and 1 deletion
+112 -1
coord.txt 0 → 100644
0.3 0.505 0
0.3 0.475 0
0.3 0.445 0
0.3 0.415 0
0.3 0.385 0
0.3 0.355 0
0.3 0.325 0
0.3 0.295 0
0.3 0.265 0
0.3 0.235 0
0.3 0.205 0
0.3 0.175 0
0.3 0.145 0
0.3 0.115 0
0.3 0.085 0
0.3 0.055 0
0.22 0.505 0
0.22 0.475 0
0.22 0.445 0
0.22 0.415 0
0.22 0.385 0
0.22 0.355 0
0.22 0.325 0
0.22 0.295 0
0.22 0.265 0
0.22 0.235 0
0.22 0.205 0
0.22 0.175 0
0.22 0.145 0
0.22 0.115 0
0.22 0.085 0
0.22 0.055 0
0.14 0.505 0
0.14 0.475 0
0.14 0.445 0
0.14 0.415 0
0.14 0.385 0
0.14 0.355 0
0.14 0.325 0
0.14 0.295 0
0.14 0.265 0
0.14 0.235 0
0.14 0.205 0
0.14 0.175 0
0.14 0.145 0
0.14 0.115 0
0.14 0.085 0
0.14 0.055 0
0.07 0.505 0
0.07 0.475 0
0.07 0.445 0
0.07 0.415 0
0.07 0.385 0
0.07 0.355 0
0.07 0.325 0
0.07 0.295 0
0.07 0.265 0
0.07 0.235 0
0.07 0.205 0
0.07 0.175 0
0.07 0.145 0
0.07 0.115 0
0.07 0.085 0
0.07 0.055 0
......@@ -8,4 +8,10 @@ sys.path.append("/home/pi/OhmPi")
from ohmpi import OhmPi
### Define object from class OhmPi
k = OhmPi(use_mux=True, idps=True)
k.test_led()
\ No newline at end of file
### Update settings if needed
k.update_settings({"nb_electrodes": 64})
k.update_settings({"injection_duration":0.5})
k.update_settings({"nb_stack": 3})
### Reset mux
#k.reset_mux()
k.ohmpi_to_bert('/home/pi/OhmPi/data/measurement_20230607T111139.csv','ABMN.txt','coord.txt')
\ No newline at end of file
......@@ -1402,7 +1402,10 @@ class OhmPi(object):
self.status = 'idle'
if plot_realtime_fulldata:
return fig,(ax1,ax2), (line1,line2), acquired_dataset
return fig,(ax1,ax2), (line1,line2), filename, acquired_dataset
else:
return filename
def run_sequence_async(self, cmd_id=None, **kwargs):
"""Runs the sequence in a separate thread. Can be stopped by 'OhmPi.interrupt()'.
Additional arguments are passed to run_measurement().
......@@ -1610,6 +1613,33 @@ class OhmPi(object):
self._switch_mux(quadrupole[i], 'on', roles[i])
else:
self.exec_logger.error('Not switching MUX : A == B -> short circuit risk detected!')
def ohmpi_to_bert(self,fname,abmn_file,coord_file):
"""Export data to BERT format.
Parameters
----------
"""
abmn = np.loadtxt(abmn_file)
nbr_abmn = len(abmn)
data = np.loadtxt(fname, comments = '#', delimiter = ',',
converters = None, skiprows = 1, usecols = [1,2,3,4,6,7], unpack = False,
ndmin = 0, encoding = 'bytes', max_rows = None)
coord = np.loadtxt(coord_file)
with open(fname +'data.dat','w') as rho_data:
rho_data.write(str(len(coord)))
rho_data.write('\n')
rho_data.write('# x y z')
rho_data.write('\n')
np.savetxt(rho_data,coord,delimiter=' ',fmt='%1.3f')
rho_data.write(str(len(data)))
rho_data.write('\n')
rho_data.write('# a b m n u i ')
rho_data.write('\n')
np.savetxt(rho_data,data, fmt='%i %i %i %i %1.3f %1.3f')
def switch_mux_off(self, quadrupole, cmd_id=None):
"""Switches off multiplexer relays for given quadrupole.
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment