neurocarto.util.edit.debug
- neurocarto.util.edit.debug.print_local(self, data, i, size=1)
print electrode data around the electrode i.
- Parameters:
self (BlueprintFunctions)
data (ndarray[tuple[int, ...], dtype[_ScalarType_co]]) – electrode data
i (int) – electrode index
size (int) – local size
- Returns:
ascii art text.
- Return type:
str
- neurocarto.util.edit.debug.profile_script(self, controller, script, /, *args, **kwargs)
Call script under cProfile.
This method works almost as same as
call_script(), butunder profiling
This method does handle generator, but ignoring the yield value. Just loop until it stops.
generate a profiling result named
profile-SCRIPT.datat the cache directory.
The
profile-SCRIPT.datfile can use following command to generate a figure:python -m gprof2dot -f pstats profile-SCRIPT.dat | dot -T png -o profile-SCRIPT.png
Add profiling action in :class:`~neurocarto.views.blueprint_script.BlueprintScriptView`
Create a function at somewhere
def profile_call(bp: BlueprintFunctions, script: str, *args, **kwargs): bp.misc_profile_script(script, *args, **kwargs)
Add function into user config
{ "BlueprintScriptView": { "actions": { "profile": "path:profile_call" } } }
- Parameters:
script (str) – script name
args – script positional arguments
kwargs – script keyword arguments
self (BlueprintFunctions)
controller (ControllerView)
- See: