Skip to content

Commit

Permalink
v3.8.4
Browse files Browse the repository at this point in the history
  • Loading branch information
dkundih committed Jun 13, 2022
1 parent e7db2e8 commit 2a924e9
Show file tree
Hide file tree
Showing 9 changed files with 37 additions and 15 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -490,3 +490,8 @@ CHANGELOG
- docstrings updated.
- new types added.
- types in init updated.

3.8.4 (13/06/2022)
- Manifesto added.
- special methods redefined.
- PEP8 alignments.
1 change: 1 addition & 0 deletions _manifesto/ABOUT
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This is the manifesto folder of the package, providing guidelines for the public.
15 changes: 15 additions & 0 deletions _manifesto/Manifesto.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
![vandal-header](https://raw.githubusercontent.com/dkundih/vandal/master/_logistics/vandal.jpg)

vandal Manifesto
=====

1. This library, once and for all, belongs to the vandal framework.

2. Vandal framework consists of vandal, duality and logistics libraries and is open for new ideas.

3. Vandal framework follows PEP8 recommendations, but not blindly and unconditionally.

4. Everyone is allowed to contribute to the project and improve it under the conditions set by the LICENSE.

David Kundih
13.06.2022.
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
duality >= 4.7.2
logistics >= 0.0.5
logistics >= 0.0.6
colorama
pandas >= 1.2.3
numpy >= 1.19.5
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
packages = find_packages(),
install_requires = [
'duality >= 4.7.2',
'logistics >= 0.0.5',
'logistics >= 0.0.6',
'colorama',
'pandas >= 1.2.3',
'numpy >= 1.19.5',
Expand Down
4 changes: 2 additions & 2 deletions vandal/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@
from logistics.plugins.types import *

# available types.
__types__ = [
types = [
VandalType,
IntegerType,
FloatType,
Expand All @@ -121,7 +121,7 @@
]

# metaclass.
__metaclass__ = [
metaclass = [
'Meta',
]

Expand Down
9 changes: 9 additions & 0 deletions vandal/hub/toolkit.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ def random_value(mean, st_dev, **rounded):
random_value = round(random.gauss(mean, st_dev))
else:
random_value = random.gauss(mean, st_dev)

return random_value

# gives random values of mean and standard deviation inputed for the amount of values defined in the pool size, if rounded = 'y', values will be rounded.
Expand All @@ -62,20 +63,23 @@ def random_pool(mean, st_dev, pool_size, **rounded):
random_pool = [round(random.gauss(mean, st_dev)) for y in range(pool_size)]
else:
random_pool = [random.gauss(mean, st_dev) for y in range(pool_size)]

return random_pool

# splits the data using a split method character.
def split_values(data, split_method):
split_values = []
for i in data:
split_values += [i.split(split_method)]

return split_values

# joins the data using a join metod character.
def join_values(data, join_method):
join_values = []
for i in data:
join_values += [join_method.join(i)]

return join_values

# replaces a defined value with a desired value.
Expand All @@ -86,13 +90,15 @@ def replace_values(data, replaced_value, replacing_value):
replace_values = []
for i in replaced_values:
replace_values += [replacing_value.join(i)]

return replace_values

# manually sorts data depending on defined array of indexes.
def list_sort(data, array):
redefined_data = []
for d in array:
redefined_data += [data[d]]

return redefined_data

# sorts the indicies in a list of values based on the index array defined as [x,x,x].
Expand All @@ -109,6 +115,7 @@ def index_sort(data, split_method, index_array):
if array_count == array_lenght:
break
array_count += 1

return remixed_data

# automatically splits all values in a list and sorts them based on the added trigger as lambda x: [x[i], x[i]] and joins them back together.
Expand All @@ -120,12 +127,14 @@ def auto_sort(data, split_method, trigger = lambda x: x[0]):
auto_sort = sorted(split_values, key = trigger)
for i in auto_sort:
merged_final += ['-'.join(i)]

return merged_final

# creates a random password with adjustable lenght (default: length = 8).
def create_password(length = 8):
import random
particles = 'abcdefghijklmnoprstuxwyzqABCDEFGHIJKLMNOPRSTUXWYZQ0123456789'

return ''.join(random.sample(particles, length))

# handles the file extenstion upon import.
Expand Down
2 changes: 1 addition & 1 deletion vandal/misc/_meta.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

]
__license__ = 'Copyright © 2021-2022 David Kundih. All rights reserved. Licensed under the Apache License, Version 2.0 | For more details about the license and terms of use visit the official vandal documentation linked at https://github.com/dkundih/vandal and https://pypi.org/project/vandal'
__version__ = '3.8.3'
__version__ = '3.8.4'
__documentation__ = 'https://github.com/dkundih/vandal | https://pypi.org/project/vandal'
__contact__ = 'dakundih@unin.hr | kundihdavid@gmail.com'
__donate__ = 'https://patreon.com/dkundih | https://buymeacoffee.com/dkundih'
Expand Down
12 changes: 2 additions & 10 deletions vandal/objects/montecarlo.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,15 +233,13 @@ def get_risk(
for num_sim in range(risk_sims):
random_change = random.choice(percent_change)
index_array = []

index_array += [today_value * (1 + (random_change))]
data[num_sim] = index_array

for sim in data[num_sim]:
if sim < today_value:
smaller += [sim]
NRisk = len(smaller) / num_sim * 100

assert (NRisk < 100), '\nTime sequence and/or number of iterations are too low for the proper risk calculation.'

return str(round(NRisk, 2)) + '%'
Expand Down Expand Up @@ -427,7 +425,6 @@ def MCapp():
listinput = input('Enter a value: ')
listinput = listinput.replace(",", ".")
listinput = float(listinput)

data.append(listinput)
except:
print('')
Expand All @@ -449,7 +446,7 @@ def MCapp():
# simulation parameters and execution.
simulations = int(input('Enter number of simulations: ') or 100)
period = int(input('Enter desired period: ') or 50)

MC = MonteCarlo(list_of_values = data, num_sims = simulations, time_seq = period)
print('')
executed = MC.execute(filtered = False)
Expand All @@ -460,21 +457,18 @@ def MCapp():

if action == 'graph':
print('')

title = input('Title: ')
x_axis = input('X axis title:')
y_axis = input('Y axis title:')

MC.graph(graph_title = title, x_title = x_axis, y_title = y_axis)

if action == 'change':
print(Fore.YELLOW + '\nSAVE OPTIONS', Fore.RESET)
print('0 | csv')
print('1 | xlsx')
print('2 | json')

file_type = input('\nEnter the number or name of file type: ')

output = MC.get_change()

try:
Expand All @@ -500,9 +494,7 @@ def MCapp():

if action == 'risk':
sample = int(input('Number of iterations to measure risk on: ') or 5000)

executed_risk = MC.get_risk(risk_sims = sample)

print(Fore.YELLOW + '\nRisk for this option is' + Fore.RESET, executed_risk[:-1], Fore.YELLOW + '%.' + Fore.RESET)

if action == 'hist' or action == 'histogram':
Expand Down

0 comments on commit 2a924e9

Please sign in to comment.