Skip to main content

Table of Contents

  1. Introduction
    1. What is DynPy?
    2. Key Features
    3. Getting Started on CoCalc
  2. How to Start / Basic Usage
    1. Example Scripts
    2. Creating First Document / Report
    3. Lookin for some help
  3. Reporting Module
    1. Overview of the Reporting Module
    2. Creating Reports
    3. Exporting Reports
    4. Practical Examples
    5. Customization Options (Advanced)
  4. Simulation Engine
  5. Data Handling
  6. Dynamic Modeling
  7. Visualization Tools
  8. Installation & Setup (Optional, for Local Development)
    1. Requirements
    2. Manual Installation
  9. Usage Examples
    1. Simulating a Dynamic System
    2. Data Import & Export
    3. Running a Custom Model
    4. Generating Reports
  10. 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.

  1. Create an account on CoCalc.
  2. Accept the project invitation using this link.
  3. Open the README FIRST file.
  4. 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

  • PDF
  • 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.

Metadata

Release files for DynPi 1.0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for DynPi 1.0.3
File Size Uploaded Provenance
dynpi-1.0.3.tar.gz 566.4 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for DynPi 1.0.3
File Interpreter ABI Platform
dynpi-1.0.3-py3-none-any.whl Python 3 none any Details

Total release size: 1.2 MB

Release files / dynpi-1.0.3.tar.gz

Download URL dynpi-1.0.3.tar.gz
Size 566.4 kB
Tags Source
SHA-256 checksum
How to use checksums
e0faf92094e35e9b64145adc41910f161b6be3a968e787720118536dff167503
BLAKE2b-256 checksum
How to use checksums
def0e60d063cc84b129613770d6f3cfb198ace7d88ccca5503a23142c0d88af1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.2

Release files / dynpi-1.0.3-py3-none-any.whl

Download URL dynpi-1.0.3-py3-none-any.whl
Size 628.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2faca6a8ffc6c7dcc422f3d121fcea316f4488a301c1daf7d9b43808d70906d2
BLAKE2b-256 checksum
How to use checksums
84955dad1ff64a71bf4bd48378229e145dc98a21766cb7197632587bf1001431
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.2

Security for DynPi 1.0.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.0.3 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page