Skip to content
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
4 changes: 3 additions & 1 deletion INGRID/ingrid.py
Original file line number Diff line number Diff line change
Expand Up @@ -836,12 +836,14 @@ def PlotPsiNormBounds(self) -> None:
Dic = {'psi_1': 'lime',
'psi_core': 'cyan',
'psi_pf_1': 'white'}
num_psi_levels = 4
elif nxpt == 2:
Dic = {'psi_core': 'cyan',
'psi_1': 'lime',
'psi_2': 'fuchsia',
'psi_pf_1': 'white',
'psi_pf_2': 'yellow'}
num_psi_levels = 7

for k, c in Dic.items():
self.PsiNorm.PlotLevel(self.settings['grid_settings'][k], color=Dic[k], label=k)
Expand All @@ -859,7 +861,7 @@ def PlotPsiNormBounds(self) -> None:
pass
self.PsiNorm.fig.legend(handles=[handle for handle in lookup.values()], labels=[label for label in lookup.keys()],
bbox_to_anchor=(0.5, 1), loc='upper center',
ncol=len([label for label in lookup.keys()]) // 3)
ncol=min((len([label for label in lookup.keys()]) + num_psi_levels) // 3, 5), facecolor="gray", framealpha=0.2)

def PlotPsiNormMagReference(self, ax: object = None) -> None:
"""
Expand Down
8 changes: 4 additions & 4 deletions INGRID/interpol.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,11 +233,11 @@ def PlotLevel(self: object, level: float = 1.0, color: str = 'red', label: str =
indexing='ij')
try:
self.psi_levels[label].collections[0].remove()
self.psi_levels[label] = plt.contour(rgrid, zgrid, data, [float(level)], colors=color, label=label, linestyles=linestyles)
self.psi_levels[label].collections[0].set_label(label)
self.psi_levels[label] = plt.contour(rgrid, zgrid, data, [float(level)], colors=color, linestyles=linestyles)
plt.plot([],[], label=label, color=color)
except:
self.psi_levels[label] = plt.contour(rgrid, zgrid, data, [float(level)], colors=color, label=label, linestyles=linestyles)
self.psi_levels[label].collections[0].set_label(label)
self.psi_levels[label] = plt.contour(rgrid, zgrid, data, [float(level)], colors=color, linestyles=linestyles)
plt.plot([],[], label=label, color=color)

def plot_data(self: object, nlevs: int = 30, interactive: bool = True, fig: object = None,
ax: object = None, view_mode: str = 'filled', refined: bool = True, refine_factor: int = 10):
Expand Down
2 changes: 2 additions & 0 deletions INGRID/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -464,6 +464,8 @@ def LoadGEQDSK(self, geqdsk_path: str) -> None:

with open(geqdsk_path, 'r') as f:
geqdsk_data = geqdsk.read(f)
if not isinstance(geqdsk_data,dict):
geqdsk_data = geqdsk_data.__dict__

#
# Extract quantities needed to initialize EfitData class
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
],
keywords='grid, mesh, generator, tokamak, edge, plasma, efit, uedge',
packages=find_packages(),
python_requires='>=3.8, <4',
python_requires='>=3.9, <4',
install_requires=[
'm2r2',
'scipy >= 1.3.1',
Expand All @@ -48,7 +48,7 @@
'matplotlib',
'tk',
'sympy',
'freeqdsk'
'freeqdsk>=0.5'
]
)

2 changes: 2 additions & 0 deletions tests/component/test_efit.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ def test_load_geqdsk(data_dir):
#
with open(eqdsk_path, 'r') as f:
baseline = geqdsk.read(f)
if not isinstance(baseline,dict):
baseline = baseline.__dict__

#
# Load data using Ingrid class
Expand Down
Loading