Changeset deaa0c6 in sasview for src/sas


Ignore:
Timestamp:
Sep 25, 2017 11:58:13 AM (7 years ago)
Author:
krzywon
Branches:
master, ESS_GUI, ESS_GUI_Docs, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_iss879, ESS_GUI_iss959, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc, magnetic_scatt, release-4.2.2, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
Children:
ffb6474
Parents:
7b07fbe
Message:

Load fit states and project filess with 2D data sets using new loader system.

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

Legend:

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

    r17e257b5 rdeaa0c6  
    11761176        final_dataset.yaxis(data._yaxis, data._yunit) 
    11771177        final_dataset.zaxis(data._zaxis, data._zunit) 
    1178         final_dataset.x_bins = data.x_bins 
    1179         final_dataset.y_bins = data.y_bins 
     1178        if len(data.data.shape) == 2: 
     1179            n_rows, n_cols = data.data.shape 
     1180            final_dataset.y_bins = data.qy_data[0::int(n_cols)] 
     1181            final_dataset.x_bins = data.qx_data[:int(n_cols)] 
    11801182    else: 
    11811183        return_string = "Should Never Happen: _combine_data_info_with_plottable input is not a plottable1d or " + \ 
  • src/sas/sascalc/dataloader/file_reader_base_class.py

    r7b07fbe rdeaa0c6  
    167167                    dataset.x_bins = dataset.qx_data[:int(n_cols)] 
    168168                dataset.data = dataset.data.flatten() 
     169                if len(dataset.data) > 0: 
     170                    dataset.xmin = np.min(dataset.qx_data) 
     171                    dataset.xmax = np.max(dataset.qx_data) 
     172                    dataset.ymin = np.min(dataset.qy_data) 
     173                    dataset.ymax = np.max(dataset.qx_data) 
    169174 
    170175    def format_unit(self, unit=None): 
     
    249254            has_error_dy = self.current_dataset.err_data is not None 
    250255            has_mask = self.current_dataset.mask is not None 
    251             has_q_data = self.current_dataset.q_data is not None 
    252256            x = self.current_dataset.qx_data 
    253257            self.current_dataset.data = self.current_dataset.data[x != 0] 
    254258            self.current_dataset.qx_data = self.current_dataset.qx_data[x != 0] 
    255259            self.current_dataset.qy_data = self.current_dataset.qy_data[x != 0] 
     260            self.current_dataset.q_data = np.sqrt( 
     261                np.square(self.current_dataset.qx_data) + np.square( 
     262                    self.current_dataset.qy_data)) 
    256263            if has_error_dy: 
    257264                self.current_dataset.err_data = self.current_dataset.err_data[x != 0] 
     
    262269            if has_mask: 
    263270                self.current_dataset.mask = self.current_dataset.mask[x != 0] 
    264             if has_q_data: 
    265                 self.current_dataset.q_data = self.current_dataset.q_data[x != 0] 
    266271 
    267272    def reset_data_list(self, no_lines=0): 
Note: See TracChangeset for help on using the changeset viewer.