Skip to content

Commit

Permalink
Update back_box_numeric.py - fix lint error for Qobj import (#155)
Browse files Browse the repository at this point in the history
* Update back_box_numeric.py - fix lint error for Qobj import

fix lint error for Qobj import

* Update plotting.py colors = None

fix lint

* Update ansys.py
  • Loading branch information
zlatko-minev authored May 21, 2024
1 parent 059990a commit 4dff819
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
3 changes: 2 additions & 1 deletion pyEPR/ansys.py
Original file line number Diff line number Diff line change
Expand Up @@ -1500,7 +1500,7 @@ def _readin_Q3D_matrix(path: str):
skipinitialspace=True,
index_col=0)
units = re.findall(r'C Units:(.*?),', text)[0]

if len(s2) > 1:
df_cond = pd.read_csv(io.StringIO(s2[1].strip()),
delim_whitespace=True,
Expand All @@ -1509,6 +1509,7 @@ def _readin_Q3D_matrix(path: str):
units_cond = re.findall(r'G Units:(.*?)\n', text)[0]
else:
df_cond = None
units_cond = None

var = re.findall(r'DesignVariation:(.*?)\n',
text) # this changed circa v2020
Expand Down
7 changes: 5 additions & 2 deletions pyEPR/calcs/back_box_numeric.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,11 @@ def make_dispersive(H, fock_trunc, fzpfs=None, f0s=None, chi_prime=False,
[H_lin, H_nl] = H
H = H_lin + H_nl
else: # make sure its a quanutm object
assert type(
H) == qutip.qobj.Qobj, "Please pass in either a list of Qobjs or Qobj for the Hamiltonian"
from qutip import Qobj
if not isinstance(H, Qobj): # Validate that the input is a Qobj instance.
raise TypeError("Please pass in either a list of Qobjs or a Qobj for the Hamiltonian")
#assert type(
# H) == qutip.qobj.Qobj, "Please pass in either a list of Qobjs or Qobj for the Hamiltonian"

print("Starting the diagonalization")
evals, evecs = H.eigenstates()
Expand Down
1 change: 1 addition & 0 deletions pyEPR/toolbox/plotting.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ def get_color_cycle(n, colormap=None, start=0., stop=1., format='hex'):
colormap = colormap or default_colormap()

pts = np.linspace(start, stop, n)
colors = None
if format == 'hex':
colors = [rgb2hex(colormap(pt)) for pt in pts]
return colors
Expand Down

0 comments on commit 4dff819

Please sign in to comment.