FileLoadThread

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

Bases: PyQt5.QtCore.QThread

Asynchronously read in a file

Parameters:

parent: QtWidget

The parent widget or None

Attributes

file_name: str Name of the file to read.
file_filter: str Type of file to read. If Auto, try all known formats.

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] [edit on github]

Initialize the thread

read_file(file_name, file_filter)[source] [edit on github]

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: Spectrum1DRef

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

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] [edit on github]

Start thread to read the file.