Python
scenario_validation_criteria
Definitions of scenario validation criteria.
Use the load_criteria function to load definitions from raw definition files.
load_criteria
load_criteria(
components=None,
load_all=False,
criteria_types=None,
reference_subset=None,
)
Load and return the criteria definitions contained in the package.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
components
|
str | list[str] | tuple[str]
|
A string or list/vector of strings. The return type changes depending on whether a list/vector or a single string is provided. |
None
|
load_all
|
bool
|
Alternatively to providing the names of individual components, the
loading of all components can be instructed with the key-word argument
|
False
|
criteria_types
|
str | list[str] | tuple[str]
|
When loading the components |
None
|
reference_subset
|
str | list[str] | tuple[str]
|
When loading the component |
None
|
Returns:
| Type | Description |
|---|---|
DataFrame | dict[str, str] | dict[str, DataFrame | dict[str, str]]
|
Returns the loaded data. This data can be a dataframe or a nested list. If multiple data components are requested, then the components are returned inside a keyworded list. |
Source code in python/scenario_validation_criteria/__init__.py
274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 | |
scenario_validation_criteria.formatting
Format bibliographic information on sources.
format_sources
format_sources(
bib_data,
style="alpha",
target="plaintext",
exclude_fields=None,
)
Convert sources to specific format.
Takes a citation style, a citation format, and (optionally) excluded fields, and returns a formatted list of sources based on the specified style and format. The sources are loaded from 'sources.bib' file.
When two or more entries share the same first author and year, a lower-case letter suffix is appended to the year to disambiguate them (e.g. "IAEA, 2024a" and "IAEA, 2024b"). Entries within each collision group are sorted alphabetically by their BibTeX key to ensure a deterministic assignment of letters.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
bib_data
|
BibliographyData
|
Bibliography data loaded from BibTeX file. |
required |
style
|
str
|
Specifies the formatting style for the bibliography entries. |
'alpha'
|
target
|
str
|
Specifies the format in which the citation should be rendered. It determines how the citation information will be displayed or structured in the final output. This can be 'plaintext' or 'html'. |
'plaintext'
|
exclude_fields
|
Optional[list]
|
Specifies a list of fields that should be excluded from the final output. These fields will be removed from the entries before formatting and returning the citation data. |
None
|
Returns:
| Type | Description |
|---|---|
list[dict]
|
A list of dictionaries containing the identifier, citation, and URL information for each entry in the bibliography data, formatted according to the specified style and form, with any excluded fields removed. |
Source code in python/scenario_validation_criteria/formatting.py
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 | |
insert_citations
insert_citations(text, citations, link=None)
Insert citations into placeholders in a text.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
text
|
str
|
Text that contains replacement patterns for citations. |
required |
citations
|
dict[str, dict[str, str]]
|
Formatted citations for each identifier. |
required |
link
|
str | None
|
Top-level page address for all citations. |
None
|
Returns:
| Type | Description |
|---|---|
str
|
The updated text, which has the patterns replaced with citations. |
Source code in python/scenario_validation_criteria/formatting.py
138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 | |