DynPy is a Python module designed for engineering calculations on dynamical systems. It provides a comprehensive framework for modeling, simulating, and analyzing dynamic mechanical systems.
Project description
Table of Contents
- Introduction
- How to Start / Basic Usage
- Reporting Module
- Simulation Engine
- Data Handling
- Dynamic Modeling
- Visualization Tools
- Installation & Setup (Optional, for Local Development)
- Usage Examples
- Licensing Information
Introduction
1. What is DynPy?
DynPy is a Python module designed for engineering calculations on dynamical systems. It provides a comprehensive framework for modeling, simulating, and analyzing dynamic mechanical systems.
2. Key Features
- Dynamics Module: Tools for modeling mechanical systems and their dynamics.
- Mechanical Models: A collection of predefined mechanical models developed by experts.
- Symbolic and Numeric Solvers: Tools for solving Ordinary Differential Equations (ODEs) using symbolic and numerical methods.
- Reporting Module: A structured reporting system for generating and exporting reports.
3. Getting Started on CoCalc
To begin working with DynPy, you need an account on CoCalc.
- Create an account on CoCalc.
- Accept the project invitation using this link.
- Open the README FIRST file.
- Follow the instructions in the introductory guide.
How to Start / Basic Usage
1. Example Scripts
To view exemplary capabilities of dynpy, run the following example script:
from dynpy.models.mechanics.pendulum import Pendulum
Pendulum().interactive_preview()
2. Creating First Document / Report
from dynpy.utilities.report import *
from dynpy.utilities.documents.guides import Guide
doc = Guide('./output/sample_report', title="Sample Report")
section = Section('Exemplary section name')
CurrentContainer(section)
display(Markdown(''' Exemplary Markdown text in the section '''))
display(ReportText(' Exemplary text appended into section '))
doc.append(section)
doc.generate_pdf(clean_tex=True)
3. Looking for some help
from dynpy.utilities.creators import list_of_guides
list_of_guides()
Defining Report Content
Creating a section of document
section = Section('Sample section name')
Creating a subsection of document
subsection = Subsection('Sample subsection name');
Selecting a section or subsection to add content to
section = Section('Sample section name')
CurrentContainer(section);
Adding text to section via ReportText
display(ReportText('Sample text'));
Adding text to section via Markdown
display(Markdown(
'''
Sample text
'''
))
Adding an image into the section
Picture('/route/to/image', caption = 'Sample caption')
Appending sections and subsections into the document
doc.append(sample_section_name)
Incorporating Simulation Results
# Add simulated data here
Adding Visualizations, Formulas and Data Tables
Creating plot and adding it to document
import matplotlib.pyplot as plt
def create_plot():
plt.plot([0, 1, 2], [0, 1, 4])
plt.savefig("./plot.png")
Picture('./plot.png', caption='Sample plot')
Adding formula to the document
d, r, fib, fia, thetaa, thetab = symbols('d r varphi_B varphi_A phi_A phi_B');
harvestine_formula = Eq(d, 2 * r * sp.asin(sp.sqrt(sp.sin((fib - fia) / 2)**2 + (cos(fia) * cos(fib) * sp.sin((thetab - thetaa) / 2)**2))))
display(SympyFormula(harvestine_formula))
Creating table and adding it to document
from dynpy.utilities.adaptable import *
predicted_travel_time = Subsection('Predicted Travel Time');
CurrentContainer(predicted_travel_time);
time_s = Symbol('time_s', positive=True)
time_h = Symbol('time_h')
length = Symbol('length', positive=True)
velocity = Symbol('velocity', positive=True)
dane = {
'Start': ['NYC', 'Albany', 'Syracuse', 'Buffalo', 'Cleveland', 'Toledo', 'Total line'],
'Stop': ['Albany', 'Syracuse', 'Buffalo', 'Cleveland', 'Toledo', 'Chicago', ''],
time_s: [3348, 3386, 2782, 4362, 2606, 4824, 21308],
time_h: ['00:55:48', '00:56:26', '00:46:22', '01:12:42', '00:43:26', '01:20:24', '05:55:08'],
length: [215.981, 219.844, 225.822, 295.54, 172.905, 369.093, 1499.185],
velocity: [232.24, 233.74, 292.22, 243.91, 238.86, 275.44, 253.29]
}
unit_dict = {
time_s: ureg.second,
time_h: ureg.hour,
length: ureg.kilometer,
velocity: ureg.kilometer / ureg.hour
}
LatexDataFrame.set_default_units(unit_dict)
def format_cell(x):
if isinstance(x, str):
return x
else:
return f'${latex(x)}$'
tabelka = LatexDataFrame.formatted(
data = dane,
).map(format_cell)
tabelka.columns = ['Start', 'Stop', 'Time [s]', 'Time [h]', 'Length [km]', 'Velocity [km/h]']
predicted_travel_time.append(tabelka.reported(caption="Travel Time Data Table"))
3. Exporting Reports
Supported Formats
- LaTeX
- Markdown
Exporting Procedures
doc.generate_pdf(clean_tex=True)
4. Practical Examples
Generating a Simple Report
from dynpy.utilities.report import *
from dynpy.utilities.templates.document import Guide
doc = Guide('./reports/sample-report')
sample_section = Section('Sample Section')
CurrentContainer(sample_section)
display(ReportText('Sample text'));
second_sample_section = Section('Second Sample Section')
CurrentContainer(second_sample_section)
display(ReportText('Sample text'));
sample_subsection = Subsection('Sample Subsection');
CurrentContainer(sample_subsection);
display(ReportText('Sample text'));
second_sample_subsection = Subsection('Second sample Subsection');
CurrentContainer(second_sample_subsection);
display(ReportText('Sample text'));
doc.append(sample_section)
doc.append(second_sample_section)
doc.append(sample_subsection)
doc.append(second_sample_subsection)
doc.generate_pdf(clean_tex=True)
5. Customization Options (Advanced)
Formatting Text and Equations
///
Customizing Layout and Styles
///
Custom styles
Utilizing Templates for Consistency
///
Use predefined templates
///
Simulation Engine
///
Data Handling
///
Dynamic Modeling
///
Installation & Setup (Optional, for Local Development)
Requirements
Python Version: Python 3.8+. Required Libraries:
- numpy
- pylatex
- sympy
- pandas
- matplotlib
- scipy
- pint
- pypandoc
- wand
Manual Installation
pip install numpy pylatex sympy pandas matplotlib scipy pint pypandoc wand
pip install dynpyds
Licensing Information
DynPy is distributed under an open-source license. Refer to the LICENSE file for details.
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 dynpi-1.0.3.tar.gz.
File metadata
- Download URL: dynpi-1.0.3.tar.gz
- Upload date:
- Size: 566.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e0faf92094e35e9b64145adc41910f161b6be3a968e787720118536dff167503
|
|
| MD5 |
9354f3b48e91cf9673933d07d5049ec3
|
|
| BLAKE2b-256 |
def0e60d063cc84b129613770d6f3cfb198ace7d88ccca5503a23142c0d88af1
|
File details
Details for the file dynpi-1.0.3-py3-none-any.whl.
File metadata
- Download URL: dynpi-1.0.3-py3-none-any.whl
- Upload date:
- Size: 628.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2faca6a8ffc6c7dcc422f3d121fcea316f4488a301c1daf7d9b43808d70906d2
|
|
| MD5 |
34178f3915063a18e574cd91e2579dd1
|
|
| BLAKE2b-256 |
84955dad1ff64a71bf4bd48378229e145dc98a21766cb7197632587bf1001431
|