diff --git a/configure_second_I2C_bus.sh b/configure_second_I2C_bus.sh new file mode 100644 index 0000000000000000000000000000000000000000..43e8b4509f750f3fb975bdec257e47c00b62bd92 --- /dev/null +++ b/configure_second_I2C_bus.sh @@ -0,0 +1,2 @@ +sudo apt-get install -y i2c-tools +echo -e "[all]\ndtoverlay=i2c-gpio,bus=4,i2c_gpio_delay_us=1,i2c_gpio_sda=22,i2c_gpio_scl=23" | sudo tee -a /boot/config.txt diff --git a/ohmpi/ohmpi.py b/ohmpi/ohmpi.py index fc70ef7b90f7e25a0758813c794c16d06a7346f5..2b49830e20d7af8611fa47c5810fa21f7ecf8891 100644 --- a/ohmpi/ohmpi.py +++ b/ohmpi/ohmpi.py @@ -823,7 +823,7 @@ class OhmPi(object): self.exec_logger.debug(f'tx pwr voltage: {self._hw.tx.pwr.voltage}, rx max voltage: {self._hw.rx._voltage_max}') return False else: - if np.array(quadrupole).all() == np.array([0, 0, 0, 0]).all(): # NOTE: No mux + if quadrupole == [0, 0, 0, 0]: # NOTE: No mux return True else: return self._hw.switch_mux(electrodes=quadrupole, state='on', bypass_check=bypass_check) @@ -917,62 +917,6 @@ class OhmPi(object): return status - def run_inversion(self, survey_name, elec_spacing=1, **kwargs): - """Invert a specific survey on the Pi using ResIPy. - - Parameters - ---------- - survey_name : str - Filename of the survey to be inverted with its extension. - To get all filenames availables, see get_data(). - elec_spacing : float, optional - Electrode spacing in meters. - **kwargs : dict, optional - Additional keyword arguments are passed to resipy.Project.invert() function. - - Returns - ------- - xzv : dict - Dictionnary with keys: X and Z for centroid of the elements of the mesh - and key 'resistivity' for their resistivity. - """ - # check if resipy is installed - try: - import sys - sys.path.append('../resipy/src/') - from resipy import Project - except Exception as e: - self.exec_logger.error('Could not import ResIPy. Make sure it is installed. Error ' + str(e)) - return - - # create project instance and run inversion - k = Project(typ='R2') - if 'reg_mode' in kwargs: - if kwargs['reg_mode'] != 0: - fname0 = '../data/' + sorted(os.listdir('../data'))[0] - k.createTimeLapseSurvey([fname0, '../data/' + survey_name]) - else: - k.createSurvey('../data/' + survey_name) - else: - k.createSurvey('../data/' + survey_name) - elec = np.zeros((k.surveys[0].df[['a', 'b', 'm', 'n']].max(), 3)) - elec[:, 0] = np.arange(0, elec.shape[0]*elec_spacing, elec_spacing) - k.setElec(elec) - k.createMesh() - k.invert(**kwargs) - k.getResults() - - # extract centroids of elements and values - df = k.meshResults[0].df - xzv = { - 'x': df['X'].values, - 'z': df['Z'].values, - 'resistivity': df['Resistivity(ohm.m)'].values - } - - self.data_logger.info(json.dumps(xzv)) - return xzv - # Properties @property def sequence(self):