Several small functions for classroom instruction.
Project description
Classroom Gizmos
This is a collection of functions for classroom instruction in
introductory physics. This is basically using ipython as a calculator
that displays the calculation and the results.
Typical usage to make a set of useful functions available in ipython:
from classroom_gizmos.handies import *
<script src="https://polyfill.io/v3/polyfill.min.js?features=es6"></script>
<script id="MathJax-script" async src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"></script>
handies
classroom_gizmos.handies is a collection of small functions
that are
useful from an ipython prompt.
Note: Imports from astropy, PyQt5, and func_timeout
Certain functions and functionality are not available when some of the
imported packages are unavailable.
The mine() function lists all the user functions defined
in handies.py.
handies defines:
cdbn(), osname(),
hostname(), call(), rad(), deg(), sinD(), cosD(), tanD(),
asinD(), acosD(), atanD(), atan2D(), atan2P(), nCr(), comb(),
pltsize(), select_file(), select_file_timeout(), getTS(), timeStampStr(),
isInstalled(),
mine()
Trig Functions in Degrees
'D' and 'P' trig functions work with degrees.
'P' inverse functions return only positive angles.
greek ⟶ a string with greek alphabet.
pltsize( w, h, dpi=150) ⟶ resizes plots in matplotlib.
getTS() ⟶ returns a readable time stamp string.
isInstalled( pkgNameStr) ⟶ returns package or None if pkg is not installed.
timeStampStr() ⟶ returns a readable, timestamp string.
mine() ⟶ lists what handies.py defines.
If PyQt5 package is available defines:
select_file and select_file_timeout
From math imports these functions:
pi, sqrt, cos, sin, tan, acos, asin, atan, atan2, degrees, radians, log, log10, exp
When astropy is available:
Defines nowMJD(); mjd2date(), date2mjd().
Imports astropy.units as "u", i.e. u.cm or u.GHz
import_install
importInstall()
pkg = importInstall( 'pkg_name')
OR
pkg = importInstall( 'pkg_name, 'PyPI_name')
This function tries to import a specified package and if that fails,
it tries to install the package and then import it.
importInstall was written so that python programs can be
distributed to students without detailed instructions on checking if
package is installed
and on installing the needed packages.
The function returns the package or None.
Warning: importInstall can not install all packages. It is less likely to install a package that is not pure python.
All functions should have doc strings that give more information about usage and parameters.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for classroom_gizmos-0.0b2.dev8.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | afe31d893af328693f691a8c081a75215d5921e7e18ac70fd0e80c16d36c5751 |
|
MD5 | c61c2a21c9de4007bc5986650c9a9fcd |
|
BLAKE2b-256 | 8f7379553e26277f0b615f94cc75cee6c2473e211f85a6c6c2584a8967068a8e |
Hashes for classroom_gizmos-0.0b2.dev8-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6816959fc7ee1ab6fb3edbb48f0bee69371fd73c75379068b9cd2580d65a7d8a |
|
MD5 | 1d6a9579ebc88c3de466a4378e343004 |
|
BLAKE2b-256 | 3ba6ff5499aba7b49fb19aaa97d637cefcf7fb7f704a970d47466a1df478bafc |