Changeset b1ec23d in sasview for src/sas/sascalc/dataloader


Ignore:
Timestamp:
Oct 17, 2018 9:07:51 AM (6 years ago)
Author:
krzywon
Branches:
master, magnetic_scatt, release-4.2.2, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, unittest-saveload
Children:
b204004
Parents:
5218180
Message:

Remove unneeded shape check, give better error when saving fails, and data info cleanup.

Location:
src/sas/sascalc/dataloader
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/sas/sascalc/dataloader/file_reader_base_class.py

    r8d5e11c rb1ec23d  
    231231                    data.mask = data.mask.astype(dtype=bool) 
    232232 
    233                 if len(data.data.shape) == 2: 
    234                     n_rows, n_cols = data.data.shape 
    235                     data.y_bins = data.qy_data[0::int(n_cols)] 
    236                     data.x_bins = data.qx_data[:int(n_cols)] 
    237                     data.data = data.data.flatten() 
    238                     data = self._remove_nans_in_data(data) 
     233                n_rows, n_cols = data.data.shape 
     234                data.y_bins = data.qy_data[0::int(n_cols)] 
     235                data.x_bins = data.qx_data[:int(n_cols)] 
     236                data.data = data.data.flatten() 
     237                data = self._remove_nans_in_data(data) 
    239238                if len(data.data) > 0: 
    240239                    data.xmin = np.min(data.qx_data) 
     
    288287        :return: 
    289288        """ 
    290         data.xaxis("\\rm{Q}", '1/A') 
    291         data.yaxis("\\rm{Intensity}", "1/cm") 
     289        data.xaxis(r"\rm{Q}", '1/A') 
     290        data.yaxis(r"\rm{Intensity}", "1/cm") 
    292291        return data 
    293292 
  • src/sas/sascalc/dataloader/loader.py

    r8d5e11c rb1ec23d  
    367367            try: 
    368368                return fn(path, data) 
    369             except Exception as exep: 
    370                 pass  # give other loaders a chance to succeed 
    371         # If we get here it is because all loaders failed 
    372         raise exep # raises last exception 
     369            except Exception as exc: 
     370                msg = "Saving file {} using the {} writer failed.\n".format( 
     371                    path, type(fn).__name__) 
     372                msg += str(exc) 
     373                logger.exception(msg)  # give other loaders a chance to succeed 
    373374 
    374375 
Note: See TracChangeset for help on using the changeset viewer.