user_interface
SystemSpecsHandler(data=None, specs_file=None)
Load and decode system specifications for test-input generation.
Supports loading from a JSON file or inferring values from a dataset.
Attributes:
specs: dict Dictionary storing system specifications.
int
Number of features.
Methods:
get_n_features() Returns the number of features.
get_nominal_features() Returns the indices of all nominal features.
get_numerical_features() Returns the indices of all numerical features.
get_int_features() Returns the indices of all features with type 'int'.
extract_minmax_values() Extracts min and max values from specifications.
extract_input_types() Extracts value types from specifications.
extract_feature_names() Extracts feature names.
extract_feature_names_with_idx() Extract feature names along with their corresponding indices.
extract_feature_names_with_idx_reversed() Extract feature indices along with their corresponding names.
Loads specifications from a JSON file or infers them from a dataset.
For details on defining specifications in JSON, refer to README.md.
Example JSON structure: { "features": [ { "name": "feature_0_name", "min": 0, "max": 100, "type": "float" or "int", "nominal": true or false }, ... ] }
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
DataFrame | None
|
Dataset used to infer specifications if specs_file is not provided. |
None
|
specs_file
|
Path | None
|
JSON file containing system specifications. |
None
|
Source code in src/flowcean/testing/generator/ddtig/user_interface/specs_handler.py
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 | |
get_n_features()
Returns the number of features defined in the specifications.
Returns:
| Type | Description |
|---|---|
int
|
Number of features. |
Source code in src/flowcean/testing/generator/ddtig/user_interface/specs_handler.py
185 186 187 188 189 190 191 | |
get_nominal_features()
Returns the indices of nominal features.
Returns:
| Type | Description |
|---|---|
list
|
A list containing indices of nominal features. |
Source code in src/flowcean/testing/generator/ddtig/user_interface/specs_handler.py
193 194 195 196 197 198 199 200 201 202 203 | |
get_numerical_features()
Returns the indices of numerical features.
Returns:
| Type | Description |
|---|---|
list
|
A list containing indices of numerical features. |
Source code in src/flowcean/testing/generator/ddtig/user_interface/specs_handler.py
205 206 207 208 209 210 211 212 213 214 215 | |
get_int_features()
Returns the indices of features with type 'int'.
Returns:
| Type | Description |
|---|---|
list
|
A list containing indices of integer-type features. |
Source code in src/flowcean/testing/generator/ddtig/user_interface/specs_handler.py
217 218 219 220 221 222 223 224 225 226 227 | |
extract_minmax_values()
Extracts the min and max values for each feature.
Returns:
| Type | Description |
|---|---|
dict
|
Dictionary mapping feature index to its min and max values. |
Example
{ 0: {'min': 0.5, 'max': 5.3}, 1: {'min': 0, 'max': 500}, 2: {'min': 0.0, 'max': 10.0} }
Source code in src/flowcean/testing/generator/ddtig/user_interface/specs_handler.py
229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 | |
extract_input_types()
Extract the input type of each feature from the specifications.
Returns:
| Type | Description |
|---|---|
dict
|
A dictionary mapping feature index to its type. |
Example
{ 0: {'type': 'float'}, 1: {'type': 'int'}, 2: {'type': 'float'} }
Source code in src/flowcean/testing/generator/ddtig/user_interface/specs_handler.py
250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 | |
extract_feature_names()
Extract the name of each feature from the specifications.
Returns:
| Type | Description |
|---|---|
list
|
A list of feature names. |
Example
["pH", "temperature", "humidity"]
Source code in src/flowcean/testing/generator/ddtig/user_interface/specs_handler.py
270 271 272 273 274 275 276 277 278 279 280 281 282 | |
extract_feature_names_with_idx()
Extract feature names along with their corresponding indices.
Returns:
| Type | Description |
|---|---|
dict
|
A dictionary mapping feature names to their indices. |
Example
{ "pH": 0, "temperature": 1, "humidity": 2 }
Source code in src/flowcean/testing/generator/ddtig/user_interface/specs_handler.py
284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 | |
extract_feature_names_with_idx_reversed()
Extract feature indices along with their corresponding names.
Returns:
| Type | Description |
|---|---|
dict
|
A dictionary mapping feature indices to their names. |
Example
{ 0: "pH", 1: "temperature", 2: "humidity" }
Source code in src/flowcean/testing/generator/ddtig/user_interface/specs_handler.py
302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 | |