bspysmg.utils.iv package#

Module contents#

Package containing the files for measuring IV curves on single devices (hardware and software), as well as on multiple devices simultaneously.

Submodules#

bspysmg.utils.iv.multiple module#

File containing a class for measuring IV curves on a single device (or surrogate model).

class bspysmg.utils.iv.multiple.MultiIVMeasurement(configs: dict, save_plot=None, show_plot=True)[source]#

Bases: object

create_input_arrays(inputs_dict: dict) array[source]#

Generates input signal arrays for each device in inputs_dict dictionary that will be used to measure the IV response of those devices. The devices can be the DNPU device or a surrogate model. It uses configs dictionary with the following keys:

  • devices: list

    List of devices for which IV response is to be computed. This list contains the names of all the devices (A,B,C,D etc) involved in the experiment.

  • shape: int

    The length of the generated signal.

  • driver: dict

    It contains the configurations for each device in the experiment which are defined in the devices list.

Parameters

inputs_dict (dict) – Dictionary containing the devices for which IV curve is to be measured as keys.

Returns

inputs_array – Generated signal arrays for each device.

Return type

np.array

gen_input_wfrm(input_range: float) array[source]#

Generates input signal to compute the IV response of DNPU device or a surrogate model. It uses configs dictionary with the following keys:

  • input_signal_type: str

    The type of signal to generate - sawtooth or sine.

  • shape: int

    The length of the generated signal.

  • direction: str [‘up’/’down’]

    The Direction of the sawtooth. If true, the sawtooth will go first up and then down. If False, the sawtooth will go first down and then up. By default up.

  • frequency: int

    The frequency of the sine wave signal.

Parameters

input_range (float) – Maximum voltage that the signal will achieve. Minimum voltage is 0.

Returns

result – Generated sawtooth or sine signal.

Return type

np.array

run_test(experiments=['IV1', 'IV2', 'IV3', 'IV4', 'IV5', 'IV6', 'IV7'], close_driver: bool = True) None[source]#

Generates the IV response of devices to a sawtooth or sine wave and shows it on the screen. It uses configs dictionary with the following keys:

  • devices: list

    List of devices for which IV response is to be computed. This list contains the names of all the devices (A,B,C,D etc) involved in the experiment.

  • driver: dict

    It contains the configurations for each device in the experiment which are defined in the devices list.

  • close_driver: boolean

    Whether to close the driver or not after running the IV curve.

bspysmg.utils.iv.simple module#

File containing a class for measuring IV curves on multiple devices PCBs.

class bspysmg.utils.iv.simple.IVMeasurement(configs: dict, info: Optional[dict] = None, model_state_dict: Optional[OrderedDict] = None)[source]#

Bases: object

iv_curve(vmax: float, vmin: float, point_no: int, input_electrode: int, up_direction: bool = True, close: bool = True, show_plot: bool = False, save_plot: Optional[bool] = None) array[source]#

Computes the IV response of DNPU device or surrogate model to an input sawtooth signal. Optionally shows the graph on screen and saves it to current directory. This is done to check if a particular electrode has non linear IV response or a negative differential resistance (NDR). Also check:

https://en.wikibooks.org/wiki/Circuit_Idea/Negative_Differential_Resistance

https://resources.pcb.cadence.com/blog/2019-what-is-linear-and-nonlinear-resistance

Parameters
  • v_max (float) – Maximum voltage that the sawtooth will achieve.

  • v_min (float) – Minimum voltage that the sawtooth will achieve.

  • point_no (int) – Number of points that the sawtooth will have.

  • input_electrode (int) – Electrode number.

  • up_direction (bool [Optional]) – Direction of the sawtooth. If true, the sawtooth will go first up and then down. If False, the sawtooth will go first down and then up. By default False.

  • close (bool [Optional]) – If set to true, it closes the driver and clears it from memory.

  • show_plot (bool [Optional]) – If set to true, it displays the generated plot.

  • save_plot (bool [Optional]) – If set to true, it saves the generated plot to current directory.

Returns

result – IV response of device or surrogate model.

Return type

np.array