We present two cases of use of SClib, a simple hack that allows easy and straightforward evaluation of C functions within python code, boosting flexibility for better trade-off between computation power and feature availability, such as visualization and existing computation routines in SciPy.

In the first case we use SClib in particle physics, to solve a system of two coupled SchrÃ¶dinger equations, a problem that arises in the theoretical description of QCD exotic bound states. We use SClib to implement the speed-critical parts of the code, namely the evaluation (in parallel, thanks to the multiprocessing python module) of two Runge-Kutta loops. Using SClib within IPython we can use NumPy and Matplotlib for the manipulation and visualization of the solutions in an interactive (a la Mathematica) environment but without any performance conceding.

The second one is an engineering application. We use SClib to evaluate the control and system derivatives in a feedback control loop for electrical motors. With this and the integration routines available in SciPy, we can run simulations of the control loop a la Simulink. The use of C code not only boosts the speed of the simulations, but also enables to test the exact same code that we use in the test rig to get experimental results. Again, integration with (I)Python gives us the flexibility to analyze and visualize the data.

We will present technical aspects of the SClib's internals, integration with (I)Python and friends, and both applications.