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(), but

  • under profiling

  • This method does handle generator, but ignoring the yield value. Just loop until it stops.

  • generate a profiling result named profile-SCRIPT.dat at the cache directory.

The profile-SCRIPT.dat file 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`

  1. Create a function at somewhere

    def profile_call(bp: BlueprintFunctions, script: str, *args, **kwargs):
        bp.misc_profile_script(script, *args, **kwargs)
    
  2. Add function into user config

    {
      "BlueprintScriptView": {
        "actions": {
          "profile": "path:profile_call"
        }
      }
    }
    
Parameters:
See:

call_script()