changed example punit

This commit is contained in:
2025-05-20 00:12:23 +02:00
parent 2e3d373100
commit ee2b8f98b7
18 changed files with 232 additions and 149 deletions

46
examplecells.py Normal file
View File

@@ -0,0 +1,46 @@
import numpy as np
from pathlib import Path
from importlib import import_module
exclude = ['examplecells.py', 'plotstyle.py', 'spectral.py']
data_cells = []
model_cells = []
for pf in sorted(Path('.').glob('*.py'), key=lambda x: x.stem):
if pf.name in exclude:
continue
print(pf.name)
figure = import_module(pf.stem)
if hasattr(figure, 'example_cell'):
name = figure.example_cell
while isinstance(name, list):
name = name[0]
print(f' found example_cell: {name}')
data_cells.append(name)
if hasattr(figure, 'example_cells'):
for name in figure.example_cells:
while isinstance(name, list):
name = name[0]
print(f' found example_cells: {name}')
data_cells.append(name)
if hasattr(figure, 'model_cell'):
name = figure.model_cell
while isinstance(name, list):
name = name[0]
print(f' found model_cell: {name}')
model_cells.append(name)
if hasattr(figure, 'model_cells'):
for name in figure.model_cells:
while isinstance(name, list):
name = name[0]
print(f' found model_cells: {name}')
model_cells.append(name)
print()
print('The following cell data are used in the plots:')
for cell in np.unique(data_cells):
print(cell)
print()
print('The following cell models are used in the plots:')
for cell in np.unique(model_cells):
print(cell)