Ajstros / pyripherals

Python solution for communicating with peripheral ICs
GNU General Public License v3.0
2 stars 3 forks source link

Update Voltage Conversions to use np.ndarrays #10

Closed Ajstros closed 2 years ago

Ajstros commented 2 years ago

Update utils.to_voltage and utils.from_voltage to use Numpy arrays for calculations. This should be faster than the list comprehension method from before. I also added a utils_test.py test file in the unit_tests folder with some tests for these functions. The current versions pass the tests.

Ajstros commented 2 years ago

Breaking I2C write right now.

TypeError: Wrong number or type of arguments for overloaded function 'okCFrontPanel_SetWireInValue'.
  Possible C/C++ prototypes are:
    OpalKellyLegacy::okCFrontPanel::SetWireInValue(int,UINT32,UINT32)
    OpalKellyLegacy::okCFrontPanel::SetWireInValue(int,UINT32)
Ajstros commented 2 years ago

Types are fixed so from_voltage returns ints and no 0D np.ndarrays. Currently using a new binary_twos_comp function. I am not sure if this should replace the original twos_comp function but it uses numpy arrays and functions instead of list comprehensions so I believe it is faster. If that change is made it will have to be a separate pull request because that may affect several other files.