Python Forum
Library for simulating the combined impact of patterns over time
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Library for simulating the combined impact of patterns over time
#1
Star 
Hi all, I made a Python library that can simulate the effect of different patterns over time. For example, the combined effect of a growing salary, inflation, spending, etc. (But also non financial things).

Looking for ideas and feedback. Developers that want to contribute are welcome! Big Grin . Below you can see a python sample of using this library.

GITHUB: https://github.com/TimoKats/pylan
PYPI: https://pypi.org/project/pylan-lib/

import matplotlib.pyplot as plt

from pylan import AddGrow, Item, Subtract

savings = Item(start_value=100)
dividends = AddGrow("90d", 100, "1y", 1.1) # the dividend will grow with 10% each year
growing_salary = AddGrow("1m", 2500, "1y", 1.2, offset="24d") # every month 24th
mortgage = Subtract("0 0 2 * *", 1500)  # cron support

savings.add_patterns([growing_salary, dividends, mortgage])
result = savings.run("2024-1-1", "2028-1-1")

x, y = result.plot_axes()

plt.plot(x, y)
plt.show()
[Image: example.png?raw=true]
buran and Gribouillis like this post
Reply
#2
Beware that your package depends on module 'croniter' which describes itself as abandonware and may disappear completely very soon!
« We can solve any problem by introducing an extra level of indirection »
Reply
#3
(Mar-03-2025, 09:26 AM)Gribouillis Wrote: Beware that your package depends on module 'croniter' which describes itself as abandonware and may disappear completely very soon!

Wow good catch! I will replace that library with something else. Do you have any suggestions for an alternative library?
Reply
#4
(Mar-03-2025, 11:01 AM)TimoKats Wrote: Do you have any suggestions for an alternative library?
No but you'll probably find candidates in Pypi, such as 'schedule' or 'python-crontab'. You could also quickly download croniter's code and include parts of it in your project.
« We can solve any problem by introducing an extra level of indirection »
Reply
#5
(Mar-03-2025, 11:34 AM)Gribouillis Wrote:
(Mar-03-2025, 11:01 AM)TimoKats Wrote: Do you have any suggestions for an alternative library?
No but you'll probably find candidates in Pypi, such as 'schedule' or 'python-crontab'. You could also quickly download croniter's code and include parts of it in your project.

I eventually changed to the cron-converter library. Thanks again for noting this!
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Generative Density Approximation for Deterministic Point Patterns: Hopalong Attractor ratwolf 2 1,231 Jan-01-2025, 04:08 AM
Last Post: ratwolf

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020