From 0414290b87cec9c10efc93acf1e4ceea19b5ef87 Mon Sep 17 00:00:00 2001 From: tillraab Date: Tue, 1 Oct 2019 14:53:18 +0200 Subject: [PATCH] config changes --- rasp_grid.py | 13 ++++++++---- rasp_grid_cfg.py | 55 ++++++++---------------------------------------- 2 files changed, 18 insertions(+), 50 deletions(-) diff --git a/rasp_grid.py b/rasp_grid.py index 0e09e71..6c43e9d 100644 --- a/rasp_grid.py +++ b/rasp_grid.py @@ -58,6 +58,8 @@ def read_cfg(cfg_file, now, init_read=False): n_rows = int(line.split(':')[1].strip()) elif "AISampleRate" in line: samplerate = int(float(line.split(':')[-1].strip().replace('kHz', '')) * 1000) + elif 'AIMaxVolt' in Line: + AImaxVolt = float(line.split(':')[-1].strip().replace('mV', '')) channels = n_rows * n_cols ### alter information and re-write ### @@ -73,7 +75,7 @@ def read_cfg(cfg_file, now, init_read=False): cfg_f.write(line) cfg_f.close() - return channels, samplerate + return channels, samplerate, AImaxVolt # for line in cfg: # if 'Columns1' in line: @@ -169,10 +171,10 @@ def main(): cfgfile = os.path.join(path, 'fishgrid.cfg') # read and edit config file - channels, rate = read_cfg(cfgfile, now) + channels, rate, AImaxVolt = read_cfg(cfgfile, now) file = os.path.join(path, 'traces-grid1.raw') - temp_file = os.path.join(path, 'temp_file.txt') + temp_file = os.path.join(path, 'temperatures.csv') record_temp = False w1_bus_path = glob.glob('/sys/bus/w1/devices/28*/w1_slave') @@ -181,6 +183,7 @@ def main(): record_temp = True f = open(file, 'wb') temp_f = open(temp_file, 'w') + temp_f.write('%-6s; %-7s\n' % ('time/s', 'T/C')) # f.close() @@ -259,6 +262,8 @@ def main(): ranges = ai_info.get_ranges(input_mode) if range_index >= len(ranges): range_index = len(ranges) - 1 + embed() + quit() # Allocate a buffer to receive the data. data = create_float_buffer(channel_count, samples_per_channel) @@ -302,7 +307,7 @@ def main(): for line in w1_file: if 't=' in line: temp = float((line.split('=')[-1].strip())) / 1000 - temp_f.write('sec: %.0f; %.3f\n' % (next_temp_t, temp)) + temp_f.write('%6.0f; %7.3f\n' % (next_temp_t, temp)) temp_f.flush() break diff --git a/rasp_grid_cfg.py b/rasp_grid_cfg.py index 3e04d72..5949af9 100644 --- a/rasp_grid_cfg.py +++ b/rasp_grid_cfg.py @@ -464,17 +464,18 @@ class MainWindow(QTabWidget): f = open('/media/pi/data1/fishgrid.cfg', 'w+') else: f = open('./fishgrid.cfg', 'w+') - + # ToDo: 'grid no.' f.write('*FishGrid\n') f.write(' Grid &1:\n') f.write(' Used1 : true\n') + f.write(' Gridno1 : 1\n') f.write(' Columns1 : %.0f\n' % int(self.Grid.col_elecs.text())) f.write(' Rows1 : %.0f\n' % int(self.Grid.row_elecs.text())) f.write(' ColumnDistance1 : %.1fcm\n' % float(self.Grid.col_space.text())) f.write(' RowDistance1 : %.1fcm\n' % float(self.Grid.row_space.text())) - f.write(' ChannelOffset1 : %.0f\n' % int(self.Grid.channel_offset.text())) - f.write(' ElectrodeType1 : %s\n' % self.Grid.elec_type.text()) - f.write(' RefElectrodeType1: %s\n' % self.Grid.ref_elec_type.text()) + # f.write(' ChannelOffset1 : %.0f\n' % int(self.Grid.channel_offset.text())) + f.write(' ElectrodeType1 : %s\n' % self.Grid.elec_type.text()) # ToDo: 'headstage' + f.write(' RefElectrodeType1: %s\n' % self.Grid.ref_elec_type.text()) # ToDo: 'screw' f.write(' RefElectrodePosX1: %.2fm\n' % float(self.Grid.ref_elec_x.text())) f.write(' RefElectrodePosY1: %.2fm\n' % float(self.Grid.ref_elec_y.text())) f.write(' WaterDepth1 : %.2fm\n' % float(self.Grid.water_depth.text())) @@ -502,50 +503,12 @@ class MainWindow(QTabWidget): f.write(' WaterOxygen : %.1fmg/l\n' % float(self.Recording.waterOxy.text())) f.write(' Comment : %s\n' % self.Recording.comment.text()) f.write(' Experimenter : %s\n' % self.Recording.experimenter.text()) - f.write(' Buffers and timing:\n') - f.write(' DataTime : %.0fms\n' % float(self.Recording.datatime.text())) - f.write(' DataInterval: %.0fms\n' % float(self.Recording.datainterval.text())) - f.write(' BufferTime : %.0fs\n' % float(self.Recording.buffertime.text())) - f.write(' Pre-processing:\n') - f.write(' PreProcessor1: none\n') - f.write(' PreProcessor2: none\n') - f.write(' PreProcessor3: none\n') - f.write(' PreProcessor4: none\n') - f.write(' PreProcessor5: none\n') - f.write(' PreProcessor6: none\n') - f.write(' PreProcessor7: none\n') - f.write(' PreProcessor8: none\n') - f.write('\n') - f.write('*CommonNoiseRemoval\n') - f.write(' CommonNoiseRemoval: none\n') - f.write('\n') - f.write('*Spectra\n') - f.write(' Size : "8192"\n') - f.write(' Overlap: true\n') - f.write(' Window : Hanning\n') - f.write(' Decibel: true\n') - f.write(' Decay : 100iterations\n') - f.write(' FMin : 0Hz\n') - f.write(' FMax : 2000Hz\n') - f.write(' Clip : true\n') - f.write('\n') - f.write('*RMSPixel\n') - f.write(' TraceLength: 10s\n') - f.write('\n') + # f.write(' Buffers and timing:\n') + # f.write(' DataTime : %.0fms\n' % float(self.Recording.datatime.text())) + # f.write(' DataInterval: %.0fms\n' % float(self.Recording.datainterval.text())) + # f.write(' BufferTime : %.0fs\n' % float(self.Recording.buffertime.text())) f.write('*Recording\n') f.write(' PathFormat: "%04Y-%02m-%02d-%02H_%02M"\n') - f.write('\n') - f.write('*Acquisition\n') - f.write(' device1 : /dev/comedi0\n') - f.write(' blacklist1: ~\n') - f.write(' device2 : /dev/comedi1\n') - f.write(' blacklist2: ~\n') - f.write(' device3 : /dev/comedi2\n') - f.write(' blacklist3: ~\n') - f.write(' device4 : /dev/comedi3\n') - f.write(' blacklist4: ~\n') - f.write(' reference : RSE\n') - f.close() exit()