Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update back_box_numeric.py - fix lint error for Qobj import #155

Merged
merged 3 commits into from
May 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading