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
53 changes: 41 additions & 12 deletions bsplines2d/_class01_plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def plot_mesh(
key=key,
ind_knot=ind_knot,
ind_cent=ind_cent,
#units=units,
# units=units,
return_neighbours=return_neighbours,
nmax=nmax,
color=color,
Expand Down Expand Up @@ -102,15 +102,15 @@ def plot_mesh(
# possibly time-varying mesh
raise NotImplementedError()
# return _plot_mesh_2d_polar(
# coll=coll,
# key=key,
# nmax=nmax,
# color=color,
# dax=dax,
# fs=fs,
# dmargin=dmargin,
# dleg=dleg,
# connect=connect,
# coll=coll,
# key=key,
# nmax=nmax,
# color=color,
# dax=dax,
# fs=fs,
# dmargin=dmargin,
# dleg=dleg,
# connect=connect,
# )


Expand All @@ -131,21 +131,46 @@ def _plot_mesh_check(
dleg=None,
):

# ----------
# key
# ----------

# which
wm = coll._which_mesh
wbs = coll._which_bsplines

# lok
lok_mesh = list(coll.dobj.get(wm, {}).keys())
lok_bs = list(coll.dobj.get(wbs, {}).keys())

# key
key = ds._generic_check._check_var(
key, 'key',
default=None,
types=str,
allowed=list(coll.dobj.get(coll._which_mesh, {}).keys()),
allowed=lok_mesh + lok_bs,
)

# bs => mesh
if key in lok_bs:
key = coll.dobj[wbs][key]['mesh']

# derive
nd = coll.dobj[coll._which_mesh][key]['nd']
mtype = coll.dobj[coll._which_mesh][key]['type']

# ----------
# crop, bck
# ----------

# crop, bck
crop = ds._generic_check._check_var(crop, 'crop', default=True, types=bool)
bck = ds._generic_check._check_var(bck, 'bck', default=True, types=bool)

# ----------
# return_neighbours, cents, knots
# ----------

if mtype in ['rect', 'tri']:
return_neighbours = True
else:
Expand All @@ -169,6 +194,10 @@ def _plot_mesh_check(
if return_neighbours is False:
ind_cent = [ind_cent]

# ----------
# other parameters
# ----------

# color
if color is None:
color = 'k'
Expand Down Expand Up @@ -949,4 +978,4 @@ def _plot_mesh_2d_recttri(
# daxang.connect()

# daxrad.show_commands()
# return daxrad, daxang
# return daxrad, daxang
47 changes: 44 additions & 3 deletions bsplines2d/_class02_BSplines2D.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
from . import _class02_interpolate as _interpolate
from . import _class02_interpolate_all as _interpolate_all
from . import _class02_operators as _operators
from . import _class02_plot_operators as _plot_operators
from . import _class02_plot_as_profile2d as _plot_as_profile2d
from . import _class02_plot_as_profile2d_compare as _plot_as_profile2d_compare
from . import _saveload
Expand Down Expand Up @@ -81,7 +82,7 @@ def add_bsplines(self, key=None, deg=None):
)
else:
dref, ddata, dobj = _compute._mesh2Dpolar_bsplines(
coll=self, keym=keym, keybs=keybs, deg=deg, # angle=angle,
coll=self, keym=keym, keybs=keybs, deg=deg, # angle=angle,
)

# --------------
Expand Down Expand Up @@ -384,7 +385,6 @@ def get_bsplines2d_vector_field_line_tracing(
dsolver=dsolver,
)


# -----------------
# Integration operators
# ------------------
Expand Down Expand Up @@ -477,6 +477,47 @@ def apply_bsplines_operator(
returnas=returnas,
)

def plot_bsplines_operator(
self,
key=None,
operator=None,
geometry=None,
crop=None,
# store vs return
return_param=None,
# specific to deg = 0
centered=None,
# to return gradR, gradZ, for D1N2 deg 0, for tomotok
returnas_element=None,
# plotting
dax=None,
fs=None,
dmargin=None,
fontsize=None,
):
""" Plot desired operator, without adding to the Collection

Return dax
"""

return _plot_operators.main(
coll=self,
key=key,
operator=operator,
geometry=geometry,
crop=crop,
return_param=return_param,
# specific to deg = 0
centered=centered,
# to return gradR, gradZ, for D1N2 deg 0, for tomotok
returnas_element=returnas_element,
# plotting
dax=dax,
fs=fs,
dmargin=dmargin,
fontsize=fontsize,
)

# -----------------
# contours
# ------------------
Expand Down Expand Up @@ -1314,4 +1355,4 @@ def save(

_saveload.restore_bsplines(self, dclas=dclas)

return out
return out
Loading
Loading