JanLahmann / RasQberry

The RasQberry project: Exploring Quantum Computing and Qiskit with a Raspberry Pi and a 3D Printer
Apache License 2.0
138 stars 25 forks source link

python read of boolean variables in rasqberry_environment.env corrupt #136

Open JanLahmann opened 2 years ago

JanLahmann commented 2 years ago

There is an issue with reading Boolean variable in rasqberry_environment.env from python.

For example, in demos/bin/RasQ-LED-display.py, the variable "LED_INVERT" is not read correctly. The following log output:

LED_INVERT = bool(config["LED_INVERT"])
print("LED_INVERT ", LED_INVERT)
LED_INVERT = config["LED_INVERT"]
print("LED_INVERT ", LED_INVERT)
LED_INVERT = False
print("LED_INVERT ", LED_INVERT)

results in

build circuit without entanglement
measurement:  0110001001101001010011001101001110001100100110001101000010100110101110001101000000100000110001100111101110010011110011000001100
LED_INVERT  True
LED_INVERT  false
LED_INVERT  False

Only the last setting leads to the desired result.

JanLahmann commented 2 years ago

workaround implemented in #137 using LED_INVERT = bool(config["LED_INVERT"]=="true" or config["LED_INVERT"]=="True") instead of LED_INVERT = bool(config["LED_INVERT"]) in file demos/bin/RasQ-LED-display.py (and other files).