Changeset a40e913 in sasview for test/sasdataloader


Ignore:
Timestamp:
Jan 11, 2018 6:29:18 AM (7 years ago)
Author:
GitHub <noreply@…>
Branches:
master, magnetic_scatt, release-4.2.2, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
Children:
8cc9048, 6eb02a5
Parents:
2bdf61a (diff), a58b5a0 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
git-author:
Paul Butler <butlerpd@…> (01/11/18 06:29:18)
git-committer:
GitHub <noreply@…> (01/11/18 06:29:18)
Message:

Merge pull request #135 from SasView?/ticket-1037

Ticket 1037: Remove nan values from 1D and 2D data objects

closes #1037

Location:
test/sasdataloader/test
Files:
4 added
2 edited

Legend:

Unmodified
Added
Removed
  • test/sasdataloader/test/utest_ascii.py

    rf53d684 rdb5196d  
    55import os.path 
    66import warnings 
     7import math 
    78warnings.simplefilter("ignore") 
    89 
     
    110111            self.assertEqual(f, None) 
    111112 
     113    def test_nan_values(self): 
     114        """ 
     115        Test loading an ascii data file with nan values saved in x, y, or dy. 
     116        """ 
     117        f_1d = self.loader.load(find("nans_in_1d_data.dat"))[0] 
     118        f_2d = self.loader.load(find("nans_in_2d_data.DAT"))[0] 
     119        for i in range(0, len(f_1d.x) - 1): 
     120            self.assertFalse(math.isnan(f_1d.x[i])) 
     121            self.assertFalse(math.isnan(f_1d.y[i])) 
     122            self.assertFalse(math.isnan(f_1d.dy[i])) 
     123        f_2d.data = f_2d.data.flatten() 
     124        f_2d.qx_data = f_2d.qx_data.flatten() 
     125        f_2d.qy_data = f_2d.qy_data.flatten() 
     126        for i in range(0, len(f_2d.data) - 1): 
     127            self.assertFalse(math.isnan(f_2d.data[i])) 
     128            self.assertFalse(math.isnan(f_2d.qx_data[i])) 
     129            self.assertFalse(math.isnan(f_2d.qy_data[i])) 
     130 
     131 
    112132if __name__ == '__main__': 
    113133    unittest.main() 
  • test/sasdataloader/test/utest_abs_reader.py

    rf53d684 rfa749b7  
    7575        data = Loader().load(find("jan08002.ABS")) 
    7676        self.assertEqual(data[0].meta_data['loader'], "IGOR 1D") 
     77 
     78    def test_usans_negative_dxl(self): 
     79        data_abs = Loader().load(find("sam14_cor.ABS")) 
     80        data_cor = Loader().load(find("sam14_cor.cor")) 
     81        for i in range(0, len(data_abs) - 1): 
     82            self.assertEquals(data_abs.x[i], data_cor.x[i]) 
     83            self.assertEquals(data_abs.y[i], data_cor.y[i]) 
     84            self.assertEquals(data_abs.dxl[i], data_cor.dxl[i]) 
     85            self.assertEquals(data_abs.dxw[i], data_cor.dxw[i]) 
     86            self.assertTrue(data_abs.dxl > 0) 
     87 
    7788 
    7889class DanseReaderTests(unittest.TestCase): 
Note: See TracChangeset for help on using the changeset viewer.