Skip to content

PhaseData's read_file function relies on old version of fractions #141

@jayspendlove

Description

@jayspendlove

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

test_phase_data.txt

For reference, I am using Python 3.9.13 and qmpy 1.4.0. Thank you!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions