A collection of utility tools for scientific computing and data analysis
Project description
Tinkerbin
A collection of utility tools for scientific computing and data analysis, designed to streamline numerical simulations, data processing, and visualization workflows.
Overview
Tinkerbin provides a comprehensive suite of tools for scientific computing applications, with a focus on:
- Numpy array manipulation and collection classes for managing complex datasets
- Numerical integration and Fourier transforms
- I/O operations and file management with intelligent path handling
- Logging and printing utilities for debugging and output formatting
- Timer functions for performance monitoring
- Parameter storage and management for simulation workflows
- Function evaluation helpers with dynamic argument handling
- IPython integration for enhanced interactive computing
Installation
From Source
git clone <repository-url>
cd tinkerbin
pip install -e .
Quick Start
import tinkerbin as tb
import tinkerbin.numpy_tools as npt
import tinkerbin.numerics_tools as num
# Set up logging
tb.setup_file_logging(log_folder_path="./logs", log_file_names="simulation.log")
# Start timing your code
tb.start_timer()
# Create mesh collections for parameter studies
class SimulationData(npt.NpMeshCollection):
# Define your data structure
pass
# Use numerical tools
discretization = num.Discretization(...)
result = num.discretize_func(your_function, discretization)
# Print timing information
tb.print_timing()
Core Modules
Numpy Tools (tinkerbin.numpy_tools)
Advanced array manipulation and collection classes:
NpArrayCollection: Manage multiple related numpy arrays with attribute-style accessNpMeshCollection: Handle meshgrid data with independent and dependent variables- Plotting utilities: Integrated visualization tools for data analysis
import tinkerbin.numpy_tools as npt
# Create a mesh collection for parameter studies
class MyData(npt.NpMeshCollection):
temperature: float
pressure: float
result: float
def calculate_results(self):
# Your calculation logic here
pass
Numerical Tools (tinkerbin.numerics_tools)
Numerical integration, Fourier transforms, and mathematical functions:
- Discretization classes: Handle numerical discretization of continuous functions
- Integration routines: Numerical integration with various methods
- Mathematical functions: Linear ramps, bump functions, and other utilities
import tinkerbin.numerics_tools as num
# Create discretization
t_disc = num.Discretization(start=0, stop=10, num_points=1000)
# Discretize a function
discretized_func = num.discretize_func(lambda t: np.sin(t), t_disc)
# Normalize the result
normalized = num.normalized(discretized_func, t_disc)
I/O and File Management (tinkerbin.io)
Intelligent file operations and path handling:
PathDic: Nested folder structure management- String transliteration: Convert mathematical expressions to valid filenames
- File operations: Enhanced file handling with automatic directory creation
import tinkerbin as tb
# Create organized folder structure
folder_structure = {
'data': None,
'figures': ['plots', 'analysis'],
'logs': None
}
paths = tb.PathDic(folder_structure, root_path="./output")
Logging and Output (tinkerbin.logging, tinkerbin.printing)
Comprehensive logging and formatted output:
- File logging: Automatic log file management
- Formatted printing: Enhanced print functions with formatting
- Progress tracking: Built-in progress indicators
import tinkerbin as tb
# Set up file logging
tb.setup_file_logging(
log_folder_path="./logs",
log_file_names="simulation.log",
append_to_existing=False
)
# Use enhanced logging
tb.log("Starting simulation...")
Timing and Performance (tinkerbin.timers)
Performance monitoring and timing utilities:
import tinkerbin as tb
# Start timing
tb.start_timer()
# Your code here...
# Print elapsed time
tb.print_timing()
Function Evaluation (tinkerbin.function_evaluation)
Dynamic function handling and argument inspection:
- Argument introspection: Automatically determine function parameters
- Dynamic evaluation: Call functions with filtered argument dictionaries
import tinkerbin as tb
# Get function arguments
args = tb.get_func_args(my_function)
# Call function with only relevant arguments from a dictionary
result = tb.pass_only_args(my_function, parameter_dict)
Examples
The examples/ directory contains complete simulation examples demonstrating:
- Quantum optics simulations: Fidelity calculations for single-photon states
- Parameter studies: Systematic exploration of parameter spaces
- Data visualization: Automated plotting and figure generation
- Output management: Organized file structure and logging
Running Examples
cd examples
python F_max_1g_plot_vs_tau.py
Development
Development Dependencies
pip install -e ".[dev]"
Code Style
The project uses Ruff for code formatting and linting:
ruff check .
ruff format .
Testing
Run tests using:
python -m unittest discover tests/
Project Structure
tinkerbin/
├── tinkerbin/ # Main package
│ ├── numpy_tools/ # Array and mesh collection tools
│ ├── numerics_tools.py # Numerical integration and math
│ ├── io.py # File operations and path handling
│ ├── logging.py # Logging utilities
│ ├── timers.py # Performance timing
│ ├── function_evaluation.py # Dynamic function handling
│ └── ... # Additional utilities
├── examples/ # Example simulations
├── tests/ # Test suite
└── output/ # Generated output files
Authors
- Jan Gulla
- Odd Cappelen
Contributing
Contributions are welcome! Please feel free to submit pull requests or open issues for bugs and feature requests.
Tinkerbin is designed for researchers and scientists who need reliable, efficient tools for numerical simulations and data analysis workflows.
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 tinkerbin-0.1.0.tar.gz.
File metadata
- Download URL: tinkerbin-0.1.0.tar.gz
- Upload date:
- Size: 2.9 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
35e8e31d47f14f23911898693add20dfe7d590f0f535bd3527ae1c2be73f36e7
|
|
| MD5 |
b2d65ad73477adbba2498306d9c46190
|
|
| BLAKE2b-256 |
0693dfb9ad009c6813f8d7efc7969204b66376f14ed2d518319603eb1d770d82
|
Provenance
The following attestation bundles were made for tinkerbin-0.1.0.tar.gz:
Publisher:
publish.yml on pudding-tech/tinkerbin
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
tinkerbin-0.1.0.tar.gz -
Subject digest:
35e8e31d47f14f23911898693add20dfe7d590f0f535bd3527ae1c2be73f36e7 - Sigstore transparency entry: 357128881
- Sigstore integration time:
-
Permalink:
pudding-tech/tinkerbin@b9b15836cc22394e57a63c88bd393ae891dd07b3 -
Branch / Tag:
refs/tags/0.1.0 - Owner: https://github.com/pudding-tech
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@b9b15836cc22394e57a63c88bd393ae891dd07b3 -
Trigger Event:
release
-
Statement type:
File details
Details for the file tinkerbin-0.1.0-py3-none-any.whl.
File metadata
- Download URL: tinkerbin-0.1.0-py3-none-any.whl
- Upload date:
- Size: 35.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
853305568a1828ad0203d05c35fb7675faacbbc0d5e1edcd10ca66cb80892fe6
|
|
| MD5 |
505a2d5518858dd8714089f0f3a79758
|
|
| BLAKE2b-256 |
505304a10d2c0b966b4463f2cd7ee872a3d18cd2f591e7cb2eaf3ab69191ebd7
|
Provenance
The following attestation bundles were made for tinkerbin-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on pudding-tech/tinkerbin
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
tinkerbin-0.1.0-py3-none-any.whl -
Subject digest:
853305568a1828ad0203d05c35fb7675faacbbc0d5e1edcd10ca66cb80892fe6 - Sigstore transparency entry: 357128910
- Sigstore integration time:
-
Permalink:
pudding-tech/tinkerbin@b9b15836cc22394e57a63c88bd393ae891dd07b3 -
Branch / Tag:
refs/tags/0.1.0 - Owner: https://github.com/pudding-tech
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@b9b15836cc22394e57a63c88bd393ae891dd07b3 -
Trigger Event:
release
-
Statement type: