Data Insight Tool¶
CAGetThread(parent=None, address='')
¶
Bases: QThread
Thread for making a CA get request to the given address. This is used to get the description of the curve.
Source code in trace/widgets/data_insight_tool.py
63 64 65 66 | |
run()
¶
Get the value for the given address. Interruptable via the stop_flag. Does not attempt to emit the PV Value if interrupted.
Source code in trace/widgets/data_insight_tool.py
68 69 70 71 72 73 74 75 76 77 78 79 80 | |
stop()
¶
Set the stop flag
Source code in trace/widgets/data_insight_tool.py
82 83 84 | |
DataVisualizationModel(parent=None)
¶
Bases: QAbstractTableModel
Table Model for fetching and storing the data for a given curve on the model. Gathers live data directly from the curve, but makes an HTTP request to the Archiver Appliance
Source code in trace/widgets/data_insight_tool.py
97 98 99 100 101 102 103 104 105 106 107 108 | |
decode_as_string
property
writable
¶
weather or not to show the value column as a string or raw data
rowCount(index=QModelIndex())
¶
Return the row count of the table
Source code in trace/widgets/data_insight_tool.py
110 111 112 113 114 | |
columnCount(index=QModelIndex())
¶
Return the column count of the table
Source code in trace/widgets/data_insight_tool.py
116 117 118 119 120 | |
data(index, role=Qt.DisplayRole)
¶
Return the data for the associated role. Currently only supporting DisplayRole.
Source code in trace/widgets/data_insight_tool.py
122 123 124 125 126 127 128 129 130 131 | |
headerData(section, orientation, role=Qt.DisplayRole)
¶
Return data associated with the header
Source code in trace/widgets/data_insight_tool.py
133 134 135 136 | |
set_description(description)
¶
Set the description of the curve. This is called when the CAGetThread emits a result_ready signal.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
description
|
str
|
The description of the curve |
required |
Source code in trace/widgets/data_insight_tool.py
152 153 154 155 156 157 158 159 160 161 162 | |
set_all_data(curve_item, x_range)
¶
Set the model's data for the given curve and the given time range. This function determines what kind of data should be saved and prompts the methods for setting live or archived data as necessary. This also saves the meta data.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
curve_item
|
TimePlotCurveItem
|
The curve for the model to collect and store data on |
required |
x_range
|
list[int] | tuple[int, int]
|
The time range to collect and store data between |
required |
Source code in trace/widgets/data_insight_tool.py
164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 | |
set_live_data(curve_item, x_range)
¶
Set the live data for the given curve in the given time range. Appends rows within the time range to the end of the model's dataframe.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
curve_item
|
TimePlotCurveItem
|
The curve for the model to collect and store data on |
required |
x_range
|
list[int] | tuple[int, int]
|
The time range to collect and store data between |
required |
Source code in trace/widgets/data_insight_tool.py
210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 | |
request_archive_data(pv_name, x_range)
¶
Request data from the Archiver Appliance for the given PV and time range. Only gets raw data, never optimized. Ends early if there is no environment variable PYDM_ARCHIVER_URL, which would contain the url for the Archiver Appliance.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
pv_name
|
str
|
The PV address to request data for |
required |
x_range
|
list[int] | tuple[int, int]
|
The time range to collect and store data between |
required |
Source code in trace/widgets/data_insight_tool.py
244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 | |
recieve_archive_reply(reply)
¶
Process the recieved reply to the request made in request_archive_data. Unpack the data and call set_archive_data. Mostly checks if the reply contains an error.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
reply
|
QNetworkReply
|
Reply to the network request made in request_archive_data |
required |
Source code in trace/widgets/data_insight_tool.py
278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 | |
set_archive_data(data_dict)
¶
Set the live data for the given curve in the given time range. Appends rows within the time range to the end of the model's dataframe.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data_dict
|
dict
|
Dictionary containing all data to be added to the model's dataframe |
required |
Source code in trace/widgets/data_insight_tool.py
303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 | |
export_data(file_path, extension)
¶
Export the model's data to the given file. Adds metadata to the top of the exported file with the curve's address, unit (if any), and description.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
file_path
|
Path
|
The path of the file to be (over)written with the exported data |
required |
extension
|
str
|
The extension of the file to be (over)written |
required |
Raises:
| Type | Description |
|---|---|
ValueError
|
Raised when export is requested without data in the model, or when an invalid file format is requested for export |
IsADirectoryError
|
Raised when the provided filepath is a directory |
Source code in trace/widgets/data_insight_tool.py
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 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 | |
has_waveform_data()
¶
Return True if any value in the Value column is a list or numpy array
Source code in trace/widgets/data_insight_tool.py
376 377 378 | |
list_to_ascii(val)
staticmethod
¶
Convert a list of integers into an ASCII string, ignoring null characters
Source code in trace/widgets/data_insight_tool.py
380 381 382 383 384 385 386 387 388 | |
DataInsightTool(parent, plot=None)
¶
Bases: QWidget
The Data Insight Tool is a standalone widget that allows users to display all archive and live data on the plot for any given curve. Users are also able to export the raw data from this tool.
Source code in trace/widgets/data_insight_tool.py
397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 | |
plot
property
writable
¶
Return the plot associated with this widget
layout_init()
¶
Initialize the layout of the Data Insight Tool widget.
Source code in trace/widgets/data_insight_tool.py
431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 | |
set_meta_data()
¶
Populate the meta_data_label with the curve's unit (if any) and description.
Source code in trace/widgets/data_insight_tool.py
476 477 478 479 480 481 482 483 | |
combobox_to_curve(combobox_ind)
¶
Convert an index for the pv_select_box combobox to the corresponding curve item from the curves model.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
combobox_ind
|
int
|
The index for pv_select_box |
required |
Returns:
| Type | Description |
|---|---|
ArchivePlotCurveItem
|
The curve item that corresponds to the PV chosen on the combobox |
Source code in trace/widgets/data_insight_tool.py
485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 | |
set_decode_as_string()
¶
set the decode_as_string flag on the self.data_vis_model based off of the self.decode_as_string_checkbox then emit the dataChanged signal from the data_vis_model for the value column
Source code in trace/widgets/data_insight_tool.py
503 504 505 506 507 508 509 | |
update_decode_as_string_visibility()
¶
Show the decode_as_string_checkbox only when the model's Value column contains arrays
Source code in trace/widgets/data_insight_tool.py
511 512 513 514 | |
update_pv_select_box()
¶
Populate the pv_select_box with all curves in the plot. This is called when the plot is updated.
Source code in trace/widgets/data_insight_tool.py
516 517 518 519 520 521 522 523 524 525 | |
export_data_to_file()
¶
Prompt the user to select a file to export data to then prompt the DataVisualizationModel to export its data to the selected file.
Source code in trace/widgets/data_insight_tool.py
527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 | |
get_data(combobox_index=-1)
¶
Prompt the DataVisualizationModel to fetch and save the data for the curve chosen by the user for the time range on the associated plot.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
combobox_index
|
int
|
The index in the pv_select_box for the user selected curve, by default -1 |
-1
|
Source code in trace/widgets/data_insight_tool.py
549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 | |