Ignore:
Timestamp:
Nov 28, 2018 12:01:20 PM (5 years ago)
Author:
Jeff Krzywon <jkrzywon@…>
Branches:
master, magnetic_scatt, release-4.2.2, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249
Children:
109afbd
Parents:
9220e89c
Message:

Load and save mask from NXcanSAS properly.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/sas/sascalc/file_converter/nxcansas_writer.py

    r9220e89c rc7c8143  
    328328        (n_rows, n_cols) = (len(data.y_bins), len(data.x_bins)) 
    329329 
    330         if n_rows == 0 and n_cols == 0: 
     330        if ((n_rows == 0 and n_cols == 0) 
     331                or (n_cols*n_rows != len(data.data.flatten()))): 
    331332            # Calculate rows and columns, assuming detector is square 
    332333            # Same logic as used in PlotPanel.py _get_bins 
     
    360361            dqy_entry = data_entry.create_dataset('dQy', data=data.dqy_data) 
    361362            dqy_entry.attrs['units'] = data.Q_unit 
     363        if data.mask is not None and not all(data.mask == [None]): 
     364            data_entry.attrs['mask'] = "mask" 
     365            mask = np.invert(np.asarray(data.mask, dtype=bool)) 
     366            data_entry.create_dataset('mask', data=mask) 
Note: See TracChangeset for help on using the changeset viewer.