my precious tables gone :(

master
Emmanuelle Vargas-Gonzalez 2018-11-28 15:34:48 -05:00
parent c3031a0282
commit 97a21c3064
2 changed files with 221 additions and 124 deletions

View File

@ -1,3 +1,9 @@
""" """
Functions to operate with STIX 2 Confidence scales. Functions to operate with STIX2 Confidence scales.
.. autosummary::
:toctree: confidence
scales
|
""" """

View File

@ -10,23 +10,30 @@ def none_low_med_high_to_value(scale_value):
High scale to its confidence integer representation. High scale to its confidence integer representation.
The scale for this confidence representation is the following: The scale for this confidence representation is the following:
==================== =====================
None/ Low/ Med/ High STIX Confidence Value .. list-table:: None, Low, Med, High to STIX Confidence
==================== ===================== :header-rows: 1
Not Specified Not Specified
None 0 * - None/ Low/ Med/ High
Low 15 - STIX Confidence Value
Med 50 * - Not Specified
High 85 - Not Specified
==================== ===================== * - None
- 0
* - Low
- 15
* - Med
- 50
* - High
- 85
Args: Args:
scale_value: A string value from the scale. Accepted strings are scale_value (str): A string value from the scale. Accepted strings are
"None", "Low", "Med" and "High". Argument is case sensitive. "None", "Low", "Med" and "High". Argument is case sensitive.
Returns: Returns:
int: The numerical representation corresponding to values in the None / int: The numerical representation corresponding to values in the
Low / Med / High scale. None / Low / Med / High scale.
Raises: Raises:
ValueError: If `scale_value` is not within the accepted strings. ValueError: If `scale_value` is not within the accepted strings.
@ -49,17 +56,23 @@ def value_to_none_low_medium_high(confidence_value):
High scale string representation. High scale string representation.
The scale for this confidence representation is the following: The scale for this confidence representation is the following:
=============== ====================
Range of Values None/ Low/ Med/ High .. list-table:: STIX Confidence to None, Low, Med, High
=============== ==================== :header-rows: 1
0 None
1-29 Low * - Range of Values
30-69 Med - None/ Low/ Med/ High
70-100 High * - 0
=============== ==================== - None
* - 1-29
- Low
* - 30-69
- Med
* - 70-100
- High
Args: Args:
confidence_value: An integer value between 0 and 100. confidence_value (int): An integer value between 0 and 100.
Returns: Returns:
str: A string corresponding to the None / Low / Med / High scale. str: A string corresponding to the None / Low / Med / High scale.
@ -86,24 +99,37 @@ def zero_ten_to_value(scale_value):
confidence integer representation. confidence integer representation.
The scale for this confidence representation is the following: The scale for this confidence representation is the following:
==================== =====================
0-10 Scale STIX Confidence Value .. list-table:: 0-10 to STIX Confidence
==================== ===================== :header-rows: 1
0 0
1 10 * - 0-10 Scale
2 20 - STIX Confidence Value
3 30 * - 0
4 40 - 0
5 50 * - 1
6 60 - 10
7 70 * - 2
8 80 - 20
9 90 * - 3
10 100 - 30
==================== ===================== * - 4
- 40
* - 5
- 50
* - 6
- 60
* - 7
- 70
* - 8
- 80
* - 9
- 90
* - 10
- 100
Args: Args:
scale_value: A string value from the scale. Accepted strings are "0" scale_value (str): A string value from the scale. Accepted strings are "0"
through "10" inclusive. through "10" inclusive.
Returns: Returns:
@ -146,24 +172,37 @@ def value_to_zero_ten(confidence_value):
representation. representation.
The scale for this confidence representation is the following: The scale for this confidence representation is the following:
=============== ==========
Range of Values 0-10 Scale .. list-table:: STIX Confidence to 0-10
=============== ========== :header-rows: 1
0-4 0
5-14 1 * - Range of Values
15-24 2 - 0-10 Scale
25-34 3 * - 0-4
35-44 4 - 0
45-54 5 * - 5-14
55-64 6 - 1
65-74 7 * - 15-24
75-84 8 - 2
85-94 9 * - 25-34
95-100 10 - 3
=============== ========== * - 35-44
- 4
* - 45-54
- 5
* - 55-64
- 6
* - 65-74
- 7
* - 75-84
- 8
* - 95-94
- 9
* - 95-100
- 10
Args: Args:
confidence_value: An integer value between 0 and 100. confidence_value (int): An integer value between 0 and 100.
Returns: Returns:
str: A string corresponding to the 0-10 scale. str: A string corresponding to the 0-10 scale.
@ -204,19 +243,27 @@ def admiralty_credibility_to_value(scale_value):
scale to its confidence integer representation. scale to its confidence integer representation.
The scale for this confidence representation is the following: The scale for this confidence representation is the following:
============================== =====================
Admiralty Credibility STIX Confidence Value .. list-table:: Admiralty Credibility Scale to STIX Confidence
============================== ===================== :header-rows: 1
6 - Truth cannot be judged (Not present)
5 - Improbable 10 * - Admiralty Credibility
4 - Doubtful 30 - STIX Confidence Value
3 - Possibly True 50 * - 6 - Truth cannot be judged
2 - Probably True 70 - (Not present)
1 - Confirmed by other sources 90 * - 5 - Improbable
============================== ===================== - 10
* - 4 - Doubtful
- 30
* - 3 - Possibly True
- 50
* - 2 - Probably True
- 70
* - 1 - Confirmed by other sources
- 90
Args: Args:
scale_value: A string value from the scale. Accepted strings are scale_value (str): A string value from the scale. Accepted strings are
"6 - Truth cannot be judged", "5 - Improbable", "4 - Doubtful", "6 - Truth cannot be judged", "5 - Improbable", "4 - Doubtful",
"3 - Possibly True", "2 - Probably True" and "3 - Possibly True", "2 - Probably True" and
"1 - Confirmed by other sources". Argument is case sensitive. "1 - Confirmed by other sources". Argument is case sensitive.
@ -251,19 +298,27 @@ def value_to_admiralty_credibility(confidence_value):
scale string representation. scale string representation.
The scale for this confidence representation is the following: The scale for this confidence representation is the following:
=============== ==============================
Range of Values Admiralty Credibility .. list-table:: STIX Confidence to Admiralty Credibility Scale
=============== ============================== :header-rows: 1
N/A 6 - Truth cannot be judged
0-19 5 - Improbable * - Range of Values
20-39 4 - Doubtful - Admiralty Credibility
40-59 3 - Possibly True * - N/A
60-79 2 - Probably True - 6 - Truth cannot be judged
80-100 1 - Confirmed by other sources * - 0-19
=============== ============================== - 5 - Improbable
* - 20-39
- 4 - Doubtful
* - 40-59
- 3 - Possibly True
* - 60-79
- 2 - Probably True
* - 80-100
- 1 - Confirmed by other sources
Args: Args:
confidence_value: An integer value between 0 and 100. confidence_value (int): An integer value between 0 and 100.
Returns: Returns:
str: A string corresponding to the Admiralty Credibility scale. str: A string corresponding to the Admiralty Credibility scale.
@ -292,20 +347,29 @@ def wep_to_value(scale_value):
confidence integer representation. confidence integer representation.
The scale for this confidence representation is the following: The scale for this confidence representation is the following:
==================================== =====================
WEP STIX Confidence Value .. list-table:: WEP to STIX Confidence
==================================== ===================== :header-rows: 1
Impossible 0
Highly Unlikely/Almost Certainly Not 10 * - WEP
Unlikely/Probably Not 20 - STIX Confidence Value
Even Chance 50 * - Impossible
Likely/Probable 70 - 0
Highly likely/Almost Certain 90 * - Highly Unlikely/Almost Certainly Not
Certain 100 - 10
==================================== ===================== * - Unlikely/Probably Not
- 20
* - Even Chance
- 50
* - Likely/Probable
- 70
* - Highly likely/Almost Certain
- 90
* - Certain
- 100
Args: Args:
scale_value: A string value from the scale. Accepted strings are scale_value (str): A string value from the scale. Accepted strings are
"Impossible", "Highly Unlikely/Almost Certainly Not", "Impossible", "Highly Unlikely/Almost Certainly Not",
"Unlikely/Probably Not", "Even Chance", "Likely/Probable", "Unlikely/Probably Not", "Even Chance", "Likely/Probable",
"Highly likely/Almost Certain" and "Certain". Argument is case "Highly likely/Almost Certain" and "Certain". Argument is case
@ -343,20 +407,29 @@ def value_to_wep(confidence_value):
representation. representation.
The scale for this confidence representation is the following: The scale for this confidence representation is the following:
=============== ====================================
Range of Values WEP .. list-table:: STIX Confidence to WEP
=============== ==================================== :header-rows: 1
0 Impossible
1-19 Highly Unlikely/Almost Certainly Not * - Range of Values
20-39 Unlikely/Probably Not - WEP
40-59 Even Chance * - 0
60-79 Likely/Probable - Impossible
80-99 Highly likely/Almost Certain * - 1-19
100 Certain - Highly Unlikely/Almost Certainly Not
=============== ==================================== * - 20-39
- Unlikely/Probably Not
* - 40-59
- Even Chance
* - 60-79
- Likely/Probable
* - 80-99
- Highly likely/Almost Certain
* - 100
- Certain
Args: Args:
confidence_value: An integer value between 0 and 100. confidence_value (int): An integer value between 0 and 100.
Returns: Returns:
str: A string corresponding to the WEP scale. str: A string corresponding to the WEP scale.
@ -389,20 +462,29 @@ def dni_to_value(scale_value):
confidence integer representation. confidence integer representation.
The scale for this confidence representation is the following: The scale for this confidence representation is the following:
======================================= =====================
DNI Scale STIX Confidence Value .. list-table:: DNI Scale to STIX Confidence
======================================= ===================== :header-rows: 1
Almost No Chance / Remote 5
Very Unlikely / Highly Improbable 15 * - DNI Scale
Unlikely / Improbable 30 - STIX Confidence Value
Roughly Even Chance / Roughly Even Odds 50 * - Almost No Chance / Remote
Likely / Probable 70 - 5
Very Likely / Highly Probable 85 * - Very Unlikely / Highly Improbable
Almost Certain / Nearly Certain 95 - 15
======================================= ===================== * - Unlikely / Improbable
- 30
* - Roughly Even Chance / Roughly Even Odds
- 50
* - Likely / Probable
- 70
* - Very Likely / Highly Probable
- 85
* - Almost Certain / Nearly Certain
- 95
Args: Args:
scale_value: A string value from the scale. Accepted strings are scale_value (str): A string value from the scale. Accepted strings are
"Almost No Chance / Remote", "Very Unlikely / Highly Improbable", "Almost No Chance / Remote", "Very Unlikely / Highly Improbable",
"Unlikely / Improbable", "Roughly Even Chance / Roughly Even Odds", "Unlikely / Improbable", "Roughly Even Chance / Roughly Even Odds",
"Likely / Probable", "Very Likely / Highly Probable" and "Likely / Probable", "Very Likely / Highly Probable" and
@ -440,20 +522,29 @@ def value_to_dni(confidence_value):
representation. representation.
The scale for this confidence representation is the following: The scale for this confidence representation is the following:
=============== =======================================
Range of Values DNI Scale .. list-table:: STIX Confidence to DNI Scale
=============== ======================================= :header-rows: 1
0-9 Almost No Chance / Remote
10-19 Very Unlikely / Highly Improbable * - Range of Values
20-39 Unlikely / Improbable - DNI Scale
40-59 Roughly Even Chance / Roughly Even Odds * - 0-9
60-79 Likely / Probable - Almost No Chance / Remote
80-89 Very Likely / Highly Probable * - 10-19
90-100 Almost Certain / Nearly Certain - Very Unlikely / Highly Improbable
=============== ======================================= * - 20-39
- Unlikely / Improbable
* - 40-59
- Roughly Even Chance / Roughly Even Odds
* - 60-79
- Likely / Probable
* - 80-89
- Very Likely / Highly Probable
* - 90-100
- Almost Certain / Nearly Certain
Args: Args:
confidence_value: An integer value between 0 and 100. confidence_value (int): An integer value between 0 and 100.
Returns: Returns:
str: A string corresponding to the DNI scale. str: A string corresponding to the DNI scale.