Skip to content

Commit

Permalink
Moved the awkward fix to the correct place. Fixed a tutorial
Browse files Browse the repository at this point in the history
  • Loading branch information
miekkasarki committed Sep 18, 2024
1 parent 64aa20b commit 9f5ee44
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 13 deletions.
23 changes: 12 additions & 11 deletions a5py/routines/virtualrun.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,14 @@ def __init__(self, ascot, nmrk, inistate, endstate, options, markers,
self.options = options
self.markers = markers
# There's a need for better solution here in case inputs are provided
#for inp in ["bfield", "efield", "plasma", "neutral", "wall", "boozer",
# "mhd", "asigma"]:
# grp = ascot.data[inp].active
# setattr(self, inp, grp)
for inp in ["bfield", "efield", "plasma", "neutral", "wall", "boozer",
"mhd", "asigma"]:
try:
grp = ascot.data[inp].active
setattr(self, inp, grp)
except:
pass

self._inistate = VirtualState(ascot, ascot._nmrk, inistate)
self._endstate = VirtualState(ascot, ascot._nmrk, endstate)

Expand Down Expand Up @@ -101,13 +105,10 @@ def __init__(self, ascot, nmrk, state, options, diag_offload_array,
"""
self.options = options
# There's a need for better solution here in case inputs are provided
for inp in ["bfield", "efield", "plasma", "neutral", "wall", "boozer",
"mhd", "asigma"]:
try:
grp = ascot.data[inp].active
setattr(self, inp, grp)
except:
pass
#for inp in ["bfield", "efield", "plasma", "neutral", "wall", "boozer",
# "mhd", "asigma"]:
# grp = ascot.data[inp].active
# setattr(self, inp, grp)
self._state = VirtualState(ascot, ascot._nmrk, state)

def pointer_increment(idx):
Expand Down
4 changes: 2 additions & 2 deletions doc/tutorials/orbitanalysis.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,10 @@
"metadata": {},
"outputs": [],
"source": [
"a5.input_init(bfield=True)",
"a5.input_init(bfield=True)\n",
"mrk = a5.data.create_input(\"marker resonance\", species=\"alpha\", rhogrid=np.linspace(0.3, 1.0, 10),\n",
" xigrid=np.linspace(-1, 1, 20), egrid=np.array([3.5e6])*unyt.eV, dryrun=True)\n",
"opt = a5.data.create_input(\"options singleorbit\", ntor=12, npol=6, dryrun=True)",
"opt = a5.data.create_input(\"options singleorbit\", ntor=12, npol=6, dryrun=True)\n",
"a5.input_free()"
]
},
Expand Down

0 comments on commit 9f5ee44

Please sign in to comment.