Ignore:
Timestamp:
Sep 15, 2016 8:33:57 AM (5 years ago)
Author:
Piotr Rozyczko <rozyczko@…>
Branches:
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
Children:
ef51b63
Parents:
fac2619
git-author:
Jeff Krzywon <krzywon@…> (08/04/16 13:37:51)
git-committer:
Piotr Rozyczko <rozyczko@…> (09/15/16 08:33:57)
Message:

Refactored Cansas HDF5 reader to allow multiple instances of SASdata of any dimensionality in a single SASentry and multiple instances of SASentry in a single file. Added unit tests to test all types of data (1 entry | 1 data, 1 entry | many data, many entry | 1 data each, many entr |, many data).

File:
1 edited

Legend:

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

    rb699768 r132db16  
    10731073        clone.source = deepcopy(self.source) 
    10741074        clone.collimation = deepcopy(self.collimation) 
     1075        clone.trans_spectrum = deepcopy(self.trans_spectrum) 
    10751076        clone.meta_data = deepcopy(self.meta_data) 
    10761077        clone.errors = deepcopy(self.errors) 
     
    12261227 
    12271228        return result 
     1229 
     1230 
     1231def combine_data_info_with_plottable(data, datainfo): 
     1232    """ 
     1233    A function that combines the DataInfo data in self.current_datainto with a plottable_1D or 2D data object. 
     1234 
     1235    :param data: A plottable_1D or plottable_2D data object 
     1236    :return: A fully specified Data1D or Data2D object 
     1237    """ 
     1238 
     1239    final_dataset = None 
     1240    if isinstance(data, plottable_1D): 
     1241        final_dataset = Data1D(data.x, data.y) 
     1242        final_dataset.dx = data.dx 
     1243        final_dataset.dy = data.dy 
     1244        final_dataset.dxl = data.dxl 
     1245        final_dataset.dxw = data.dxw 
     1246        final_dataset.xaxis(data._xaxis, data._xunit) 
     1247        final_dataset.yaxis(data._yaxis, data._yunit) 
     1248    elif isinstance(data, plottable_2D): 
     1249        final_dataset = Data2D(data.data, data.err_data, data.qx_data, data.qy_data, data.q_data, 
     1250                               data.mask, data.dqx_data, data.dqy_data) 
     1251        final_dataset.xaxis(data._xaxis, data._xunit) 
     1252        final_dataset.yaxis(data._yaxis, data._yunit) 
     1253        final_dataset.zaxis(data._zaxis, data._zunit) 
     1254    else: 
     1255        return_string = "Should Never Happen: _combine_data_info_with_plottable input is not a plottable1d or " + \ 
     1256                        "plottable2d data object" 
     1257        return return_string 
     1258 
     1259    final_dataset.xmax = data.xmax 
     1260    final_dataset.ymax = data.ymax 
     1261    final_dataset.xmin = data.xmin 
     1262    final_dataset.ymin = data.ymin 
     1263    final_dataset.title = datainfo.title 
     1264    final_dataset.run = datainfo.run 
     1265    final_dataset.run_name = datainfo.run_name 
     1266    final_dataset.filename = datainfo.filename 
     1267    final_dataset.notes = datainfo.notes 
     1268    final_dataset.process = datainfo.process 
     1269    final_dataset.instrument = datainfo.instrument 
     1270    final_dataset.detector = datainfo.detector 
     1271    final_dataset.sample = datainfo.sample 
     1272    final_dataset.source = datainfo.source 
     1273    final_dataset.collimation = datainfo.collimation 
     1274    final_dataset.trans_spectrum = datainfo.trans_spectrum 
     1275    final_dataset.meta_data = datainfo.meta_data 
     1276    final_dataset.errors = datainfo.errors 
     1277    return final_dataset 
Note: See TracChangeset for help on using the changeset viewer.