Comments (7)
Yes - the output on the Fair Simple Report
from pyfair.
Hey, @markchatters . Thanks for your interest.
Are you talking about the display on on the output of the FairSimpleReport?
from pyfair.
from pyfair.
I may have missed something - perhaps there already is a way to do this ?
from pyfair.
Not nicely there's not. The only thing I can think of is supplying a new format string to the FairSimpleReport before you calculate it.
import pyfair
# Create using LEF (PERT), PL, (PERT), and SL (constant)
model1 = pyfair.FairModel(name="Regular Model 1", n_simulations=10_000)
model1.input_data('Threat Event Frequency', low=20, most_likely=100, high=900)
model1.input_data('Loss Magnitude', low=3_000_000, most_likely=3_500_000, high=5_000_000)
model1.input_data('Vulnerability', low=.011, most_likely=.225, high=.934)
model1.calculate_all()
# Create report comparing 2 vs metamodel.
fsr = pyfair.FairSimpleReport([model1])
################################################################
# Change your vuln format string
fsr._format_strings['Vulnerability'] = '{0:.3f}'
################################################################
# Output stuff
fsr.to_html('output.html')
from pyfair.
For the sake of completeness ....
The FairSimpleReport inherits from the FairBaseReport. This FairBaseReport has a formatting table. If you change a format string AFTER instantiation but BEFORE rendering, if should respect your new formatting. That said, the report is pretty fragile so anything beyond a few decimal places runs the risk of moving things out of place.
class FairBaseReport(object):
"""A base class for creating FairModel and FairMetaModel reports
This class exists to provide a common base for mutliple report types.
It carries with it formatting data, file paths, and a variety of
methods for creating report components. It is not intended to be
instantiated on its own.
"""
def __init__(self, currency_prefix='$'):
# Add formatting strings
self._currency_prefix = currency_prefix
self._model_or_models = None
self._currency_format_string = currency_prefix + '{0:,.0f}'
self._float_format_string = '{0:.2f}'
self._format_strings = {
'Risk' : self._currency_format_string,
'Loss Event Frequency' : self._float_format_string,
'Threat Event Frequency' : self._float_format_string,
'Vulnerability' : self._float_format_string,
'Contact Frequency' : self._float_format_string,
'Probability of Action' : self._float_format_string,
'Threat Capability' : self._float_format_string,
'Control Strength' : self._float_format_string,
'Loss Magnitude' : self._currency_format_string,
'Primary Loss' : self._currency_format_string,
'Secondary Loss' : self._currency_format_string,
'Secondary Loss Event Frequency' : self._float_format_string,
'Secondary Loss Event Magnitude' : self._currency_format_string,
}
from pyfair.
great - thank you - that worked !
If I could be cheeky it would also be good if the distribution curve allowed for a max value less than 1 - but thank you for your prompt reply
from pyfair.
Related Issues (20)
- Examples for customizing HTML Output and specific Charts HOT 4
- Meta Model Average vs. Sum Operators HOT 11
- documentation fix from_json HOT 1
- cyber insurance talk HOT 1
- Store finished simulation calculations (Min, Max, Mean) with Serialized JSON model
- Currency prefix on charts HOT 1
- Secondary losses computed through input_multi_data are wrong
- Futurewarning in tree_graph.py HOT 1
- futurewarning in model.py
- Matplotlib UserWarning in violin.py
- DB Write and read give different results
- Pandas now throws an error not a warning HOT 1
- Migrate build.image -> build.os
- Add Github actions for rtd, tests, build docker, push docker registry, push to PyPi.
- Modernize 🧑🔬 (build sys, pypi classifier,dependencies, unit testing, contrib.md, pre-com hooks, lint, semantic rels)
- Multiple Errors Thrown: Mac OS Ventura - (Matplotlib + Pandas deprecations) HOT 1
- Loss + Probability Excellence Curves do not display correctly when gamma is altered
- Provide the 90th percentile
- Report the mode value in the results
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pyfair.