BCDA-APS / mdaviz

Data visualization for mda
https://bcda-aps.github.io/mdaviz/
Other
3 stars 0 forks source link

Folder QAbtractTableModel can be slow #28

Closed rodolakis closed 7 months ago

rodolakis commented 1 year ago

After implement the number of pts and dimension in the table model, loading is noticeably slower.

        self.actions_library = {
            "Prefix": lambda file: file.rsplit("_", 1)[0],
            "Scan #": lambda file: int(file.rsplit("_", 1)[1].split(".")[0]),
            "Points": lambda file: self.get_file_pts(file),
            "Dim": lambda file: self.get_file_dim(file),
            "Size": lambda file: self.get_file_size(file),
            "Date": lambda file: self.get_file_date(file),
        }

        self.columnLabels = list(self.actions_library.keys())

with:

    def get_file_pts(self, file):
        filepath = self.get_file_path(file)
        return readMDA(str(filepath))[1].curr_pt

    def get_file_dim(self, file):
        filepath = self.get_file_path(file)
        return readMDA(str(filepath))[1].dim
prjemian commented 7 months ago

Could be v2

rodolakis commented 7 months ago

This is addressed with PR #91 (close issue #88): When building the table view using the action library as defined in the table model, every action was done consecutively and implied to each read file as many times as they were actions. I am now getting all the info at once, which only requires to read the file 1 time.