"Nb samples [-]":len(self._hw.readings),# TODO: use only samples after a delay in each pulse
# if self.sequence is None:
"fulldata":self._hw.readings[:,[0,-2,-1]],
# if self.idps:
# "I_stack [mA]": i_stack_mean,
#
# "I_std [mA]": i_std,
# # self.switch_dps('on')
# "I_per_stack [mA]": np.array([np.mean(i_stack[i*2:i*2+2]) for i in range(nb_stack)]),
# self.pin2 = self.mcp_board.get_pin(2) # dsp +
# "Vmn_stack [mV]": vmn_stack_mean,
# self.pin2.direction = Direction.OUTPUT
# "Vmn_std [mV]": vmn_std,
# self.pin2.value = True
# "Vmn_per_stack [mV]": np.array([np.diff(np.mean(vmn_stack[i*2:i*2+2], axis=1))[0] / 2 for i in range(nb_stack)]),
# self.pin3 = self.mcp_board.get_pin(3) # dsp -
# "R_stack [ohm]": r_stack_mean,
# self.pin3.direction = Direction.OUTPUT
# "R_std [ohm]": r_stack_std,
# self.pin3.value = True
# "R_per_stack [Ohm]": np.mean([np.diff(np.mean(vmn_stack[i*2:i*2+2], axis=1)) / 2 for i in range(nb_stack)]) / np.array([np.mean(i_stack[i*2:i*2+2]) for i in range(nb_stack)]),
# time.sleep(4)
# "PS_per_stack [mV]": np.array([np.mean(np.mean(vmn_stack[i*2:i*2+2], axis=1)) for i in range(nb_stack)]),
#
# "PS_stack [mV]": ps_stack_mean,
# self.pin5 = self.mcp_board.get_pin(5) #IHM on mesaurement
# "R_ab [ohm]": Rab
# self.pin5.direction = Direction.OUTPUT
}
# self.pin5.value = True
# self.pin6 = self.mcp_board.get_pin(6) #IHM on mesaurement
# self.pin6.direction = Direction.OUTPUT
# self.pin6.value = False
# self.pin7 = self.mcp_board.get_pin(7) #IHM on mesaurement
# self.pin7.direction = Direction.OUTPUT
# self.pin7.value = False
# if self.idps:
# if self.DPS.read_register(0x05,2) < 11:
# self.pin7.value = True# max current allowed (100 mA for relays) #voltage
# ps_stack_mean = np.mean(np.array([np.mean(np.mean(vmn_stack[i * 2:i * 2 + 2], axis=1)) for i in range(nb_stack)]))
# create a dictionary and compute averaged values from all stacks
# if self.board_version == 'mb.2023.0.0':
# d = {
# "time": datetime.now().isoformat(),
# "A": quad[0],
# "B": quad[1],
# "M": quad[2],
# "N": quad[3],
# "inj time [ms]": (end_delay - start_delay) * 1000. if not out_of_range else 0.,
# "Vmn [mV]": sum_vmn / (2 * nb_stack),
# "I [mA]": sum_i / (2 * nb_stack),
# "R [ohm]": sum_vmn / sum_i,
# "Ps [mV]": sum_ps / (2 * nb_stack),
# "nbStack": nb_stack,
# "Tx [V]": tx_volt if not out_of_range else 0.,
# "CPU temp [degC]": self._hw.cpu_temperature,
# "Nb samples [-]": self.nb_samples,
# "fulldata": fulldata,
# "I_stack [mA]": i_stack_mean,
# "I_std [mA]": i_std,
# "I_per_stack [mA]": np.array([np.mean(i_stack[i*2:i*2+2]) for i in range(nb_stack)]),
# "Vmn_stack [mV]": vmn_stack_mean,
# "Vmn_std [mV]": vmn_std,
# "Vmn_per_stack [mV]": np.array([np.diff(np.mean(vmn_stack[i*2:i*2+2], axis=1))[0] / 2 for i in range(nb_stack)]),
# "R_stack [ohm]": r_stack_mean,
# "R_std [ohm]": r_stack_std,
# "R_per_stack [Ohm]": np.mean([np.diff(np.mean(vmn_stack[i*2:i*2+2], axis=1)) / 2 for i in range(nb_stack)]) / np.array([np.mean(i_stack[i*2:i*2+2]) for i in range(nb_stack)]),
# "PS_per_stack [mV]": np.array([np.mean(np.mean(vmn_stack[i*2:i*2+2], axis=1)) for i in range(nb_stack)]),
# "PS_stack [mV]": ps_stack_mean,
# "R_ab [ohm]": Rab
# }
# print(np.array([(vmn_stack[i*2:i*2+2]) for i in range(nb_stack)]))
# elif self.board_version == '22.10':
# d = {
# "time": datetime.now().isoformat(),
# "A": quad[0],
# "B": quad[1],
# "M": quad[2],
# "N": quad[3],
# "inj time [ms]": (end_delay - start_delay) * 1000. if not out_of_range else 0.,