py4cl2

2023-06-18

Some improvements over py4cl. py4cl is a library for interfacing with python libraries from common lisp, using streams to communicate with the python process. Report the issues at https://github.com/digikar99/py4cl2/issues (More) Documentation is available at https://digikar99.github.io/py4cl2/

Upstream URL

github.com/digikar99/py4cl2

Author

py4cl author: Ben Dudson <benjamin.dudson@york.ac.uk> py4cl2 maintainer: Shubhamkar Ayare <shubhamayare@yahoo.co.in>

License

MIT
README

This is a fork of bendudson/py4cl.

Github Pages

Detailed documentation is available on github-pages (could be a bit outdated).

Releases

Check the Releases section. That said, if you are looking for stability, look at py4cl and not py4cl2, at least not in 2021. You may use py4cl2 on use-and-throw projects, or use it without using "edgy" features (not yet classified).

Contribution and PRs

Please test using py4cl2-tests.

Quick Demonstration

(ql:quickload :py4cl2 :silent t)

(py4cl2:defpymodule "numpy" nil :lisp-package "NP")
(py4cl2:defpymodule "scipy.integrate" nil :lisp-package "INTEGRATE")

;; Integrate some ODEs
(defparameter *data*
  (integrate:odeint 
   :func (lambda (y time) 
           (list (aref y 1)       ; dy[0]/dt = y[1]
                 (- (aref y 0)))) ; dy[1]/dt = -y[0]
   :y-0 #(1.0 0.0)   ; Initial state
   :t (np:linspace :start 0.0 :stop (* 2 pi) :num 20)))
                                        ; Vector of times

; (array-dimensions *data*) => (20 2)

;; Make a plot, save and show it in a window
(py4cl2:defpymodule "matplotlib.pyplot" nil :lisp-package "PLT")

(plt:plot *data*)
(plt:xlabel :xlabel "Time")
(plt:savefig "result.pdf")
(plt:show)

Great thanks to Ben Dudson for starting this project, and documenting it enough to make it more-buildable!

Dependencies (9)

  • alexandria
  • bordeaux-threads
  • cl-json
  • float-features
  • iterate
  • numpy-file-format
  • parse-number
  • trivial-garbage
  • uiop

Dependents (1)

  • GitHub
  • Quicklisp