I am trying to read phase data from a .txt file into a PhaseData object, which throws an error AttributeError: module 'fractions' has no attribute 'gcd'. This is because the reduce_by_gcd function in qmpy/utils/string.py relies on a function fractions.gcd, which no longer exists in the fractions package. gcd is only in fractions<3.9, now you must use math.gcd. Here is a code example to replicate this bug.
from qmpy import PhaseData
pd = PhaseData()
pd.read_file("test_phase_data.txt") #this file is attached to this comment
I am trying to read phase data from a .txt file into a PhaseData object, which throws an error
AttributeError: module 'fractions' has no attribute 'gcd'
. This is because thereduce_by_gcd
function in qmpy/utils/string.py relies on a functionfractions.gcd
, which no longer exists in the fractions package.gcd
is only in fractions<3.9, now you must usemath.gcd
. Here is a code example to replicate this bug.test_phase_data.txt
For reference, I am using Python 3.9.13 and qmpy 1.4.0. Thank you!