Giter VIP home page Giter VIP logo

pycse's Introduction

Coverage Status

If you want to cite this project, use this doi:10.5281/zenodo.19111.

10.5281/zenodo.19111
@misc{john_kitchin_2015_19111,
  author       = {John R. Kitchin},
  title        = {pycse: First release},
  month        = jun,
  year         = 2015,
  doi          = {10.5281/zenodo.19111},
  url          = {http://dx.doi.org/10.5281/zenodo.19111}
}

This git repository hosts my notes on using python in scientific and engineering calculations. The aim is to collect examples that span the types of computation/calculations scientists and engineers typically do to demonstrate the utility of python as a computational platform in engineering education.

Most of the sections in the pycse.org file are posted at http://jkitchin.github.com. Feel free to leave comments there.

You may also like to visit the html version of the document at: http://jkitchin.github.com/pycse/pycse.html

You may want to install the python library with pycse:

pip install pycse

Feeling brave? Try:

pip install git+git://github.com/jkitchin/pycse

John Kitchin [email protected]

What can you do with it?

org-mode integration

If you use org-mode and regular python blocks consider this:

import pycse.orgmode as org
import matplotlib.pyplot as plt

data = [['x', 'y'], None, [1, 2], [2, 4]]
org.table(data, name='table-data', caption='Data from a python table')

print()

plt.plot([4, 5, 6])
org.figure(plt.savefig('images/a-figure.png'), name='fig:1', caption='A figure in org-mode')
xy
12
24

images/a-figure.png

The orgmode module provides functions that generate org syntax for many org-elements. See for more details: pydoc:pycse.orgmode

These don’t work as well with ipython blocks. Ipython has a different org-integration setup in ob-ipython (an emacs library).

Python/lisp interaction

You can use Python to generate lisp. You might do that to generate code to be run in lisp, e.g.

from pycse.lisp import *

print([Symbol("setf"), Symbol("x"), Cons("a", 5)].lisp)

Or you might want to use the results from a Python command in lisp like this:

(run-python)
(mapcar (lambda (x) (* 2 x))
	(read (python-shell-send-string-no-output
	       "from pycse.lisp import *
import numpy as np
a = np.array([0, 1, 2, 3]) * 2
print(a.lisp)")))

Float comparisons

Float comparisons are tricky because they are not exact. Pycse provides these comparison functions which use a tolerance in the comparison:

feq==
flt<
fgt>
fle<=
fge>=

pycse's People

Contributors

jkitchin avatar johnrkitchin avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.