Small set of tools and functions for scientific code and scripts.
Project description
SciScriptTools
Small set of tools and functions for scientific code and scripts.
Install
pip
pip install sciscripttools
Build from Source
git clone https://github.com/lifelemons/sciscripttools.git
cd sciscripttools
python setup.py install
Examples
IO
An example to get started with the IO tools. It can save relatively basic python objects, such a values, strings, arrays, and dictionaries of those items.
import sciscripttools as st
power = [4,5,6]
st.save_data("power_exp_01", power) # save a value, arrary, or dictionary
exp_info = {"id": 20200117, "wire_r" : 0.005,
"lengths_1": [0.1, 0.5, 1.5]}
st.save_data("exp_01", exp_info, directory="data/")
w1 = [0.1, 0.5, 1.5]
w2 = [0.1, 0.3, 1.7]
w3 = [0.1, 0.6, 1.2]
radii = st.create_dictionary("w1",w1, "w2", w2, "w3", w3)
st.save_data("radii", radii)
Load the previous saved data with
import sciscripttools as st
exp_info = st.load_dictionary("exp_01", directory="data/")
keys, radii = st.load_data("radii", keys = ["w1", "w3"]) # load straight into arrays
power = st.load_item("power_exp_01")
Plot
An example to get started with the plotting tools.
Note: standard_font class and the unit functions of the standard_figure class require LaTeX!
import numpy as np
import matplotlib.pyplot as plt
import sciscripttools as st
# data
x = np.linspace(0, 2)
y = x + np.random.rand(len(x))
y2 = x + np.random.rand(len(x))
# figure
fig_params = st.figure_parameters() # generate parameters
st.standard_font(font_size = fig_params.font_size) # standarise the font
# normal matplotlib plotting
fig, axes = plt.subplots(1, 2, sharey = True) # create matplotlib figure
ax1, ax2 = axes
# plot data
ax1.plot(x, y)
ax2.plot(x, y2)
for ax in axes:
ax.set_ylim(0, 3)
fig.subplots_adjust(wspace = fig_params.adjust_subplot_wspace) # set subplot width spacing
sf = st.standard_figure(fig, axes, fig_params) # create standard_figure
sf.add_subplot_labels()
# add units
ylabel = "Power"; yunit = "\\watt"
sf.ylabel(ax1, ylabel, yunit)
xlabel = "Time"; xunit = "\\second"
sf.xlabel(axes, xlabel, xunit)
fig.savefig("quick_plot.png")
Contribute
Found a bug, want to add functionality, or fixed a bug? Create an issue or pull request. Any comments or feedback, please write them down in an issue.
Links
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file sciscripttools-0.2.2.tar.gz.
File metadata
- Download URL: sciscripttools-0.2.2.tar.gz
- Upload date:
- Size: 25.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.1.0 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/3.6.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8d62b2b5e4e16f46b461a9bde1ab9fd34499679f8811b79b58b5485c6c9cb684
|
|
| MD5 |
704d62bafb7982984992d569f12b625e
|
|
| BLAKE2b-256 |
9521ba0cf2b496a6f33ffa2c3b8ec150f18d85f84ceef1675a82e7bf4ccf1059
|
File details
Details for the file sciscripttools-0.2.2-py3-none-any.whl.
File metadata
- Download URL: sciscripttools-0.2.2-py3-none-any.whl
- Upload date:
- Size: 39.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.1.0 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/3.6.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5ae16c75a2b92c8f10dc1be527c4fe5e3bec6de3f4e0847a5cfad37b805383a6
|
|
| MD5 |
57bc411a1299a7f745555bf293962bc1
|
|
| BLAKE2b-256 |
06f2c6c9319b2c7e63b63d418347535988d717f32847ce9eabb1b45d0e482709
|