Out of the box profilingο
Pycharm professional (free for educational email accounts) integrates in its GUI a profiling option that is third way to execute any code apart Run or Debug. Please go here for more details.
Profiling a scriptο
The simplest profiling you can do is to have a specific python script that does something you want to profile.
The following code will use Scipion Manager to list the available projects
from scipion.__main__ import main
# Initialize scipion environment
main(justinit=True)
from pyworkflow.project import Manager, Project
# Create a new project
manager = Manager()
for i, p in enumerate(manager.listProjects()):
print(p)
Note
Note that main(justinit=True) is needed to initialize Scipion using the config file and have full API functionality.
Run configurationο
Now you are going to need to have a specific pycharm run configuration. Fill:
Script path: point to your performance script .py file
Environment variables: You need to add SCIPION_HOME, and LD_LIBRARY_PATH
Once done you should br able to run, debug or profile your script
Note
See skipping scipion launcher for a more detailed explanation.