FileLoadThread

class specviz.core.threads.FileLoadThread(parent=None)[source]

Bases: PyQt5.QtCore.QThread

Asynchronously read in a file

Parameters:
  • parent (QtWidget) – The parent widget or None
  • Call
  • ----
  • file_name (str) – Name of the file to read.
  • file_filter (str) – Type of file to read.
file_name

str – Name of the file to read.

file_filter

str – Type of file to read. If Auto, try all known formats.

Signals
-------
status(message, timeout)
State of the thread
message: The status message timeout: Time (msec) to display message
result(Spectrum1DRef)

The file’s data

Attributes Summary

result
status

Methods Summary

__call__(file_name, file_filter) Initialize the thread
read_file(file_name, file_filter) Convenience method that directly reads a spectrum from a file.
run() Start thread to read the file.

Attributes Documentation

result
status

Methods Documentation

__call__(file_name, file_filter)[source]

Initialize the thread

read_file(file_name, file_filter)[source]

Convenience method that directly reads a spectrum from a file.

Parameters:
  • file_name (str) – Name of the file to read.
  • file_filter (str) – Type of file to read. If Auto, try all known formats.
Returns:

data – The file’s data or None if no known formats are found.

Return type:

Spectrum1DRef

Notes

This exists mostly to facilitate development workflow. In time it could be augmented to support fancier features such as wildcards, file lists, mixed file types, and the like. Note that the filter string is hard coded here; its details might depend on the intrincacies of the registries, loaders, and data classes. In other words, this is brittle code.

run()[source]

Start thread to read the file.