Changeset 2b442811 in sasview


Ignore:
Timestamp:
Jan 4, 2018 9:03:39 PM (4 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:
58a8f76, 1b605fb, 31b9987, af7d2e5
Parents:
19e584b (diff), fa749b7 (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/04/18 21:03:39)
git-committer:
GitHub <noreply@…> (01/04/18 21:03:39)
Message:

Merge pull request #134 from SasView?/ticket-489

Ticket 489: Properly handle negative dx values in the ABS reader.

closes #489

Files:
5 added
3 edited

Legend:

Unmodified
Added
Removed
  • src/sas/sascalc/dataloader/readers/abs_reader.py

    r1efbc190 re3775c6  
    2929    type_name = "IGOR 1D" 
    3030    # Wildcards 
    31     type = ["IGOR 1D files (*.abs)|*.abs"] 
     31    type = ["IGOR 1D files (*.abs)|*.abs", "IGOR 1D USANS files (*.cor)|*.cor"] 
    3232    # List of allowed extensions 
    33     ext = ['.abs'] 
     33    ext = ['.abs', '.cor'] 
    3434 
    3535    def get_file_contents(self): 
     
    4646        self.current_datainfo = DataInfo() 
    4747        self.current_datainfo.filename = filepath 
    48         self.reset_data_list(len(lines)) 
    4948        detector = Detector() 
    5049        data_line = 0 
     
    188187                    self.current_dataset.y[data_line] = _y 
    189188                    self.current_dataset.dy[data_line] = _dy 
    190                     self.current_dataset.dx[data_line] = _dx 
     189                    if _dx > 0: 
     190                        self.current_dataset.dx[data_line] = _dx 
     191                    else: 
     192                        if data_line == 0: 
     193                            self.current_dataset.dx = None 
     194                            self.current_dataset.dxl = np.zeros(len(lines)) 
     195                            self.current_dataset.dxw = np.zeros(len(lines)) 
     196                        self.current_dataset.dxl[data_line] = abs(_dx) 
     197                        self.current_dataset.dxw[data_line] = 0 
    191198                    data_line += 1 
    192199 
     
    197204                    pass 
    198205 
     206            # SANS Data: 
    199207            # The 6 columns are | Q (1/A) | I(Q) (1/cm) | std. dev. 
    200208            # I(Q) (1/cm) | sigmaQ | meanQ | ShadowFactor| 
    201             if line.count("The 6 columns") > 0: 
     209            # USANS Data: 
     210            # EMP LEVEL: <value> ; BKG LEVEL: <value> 
     211            if line.startswith("The 6 columns") or line.startswith("EMP LEVEL"): 
    202212                is_data_started = True 
    203213 
  • src/sas/sascalc/dataloader/readers/associations.py

    r574adc7 ra32c19c  
    2626    ".dat": "red2d_reader", 
    2727    ".abs": "abs_reader", 
     28    ".cor": "abs_reader", 
    2829    ".sans": "danse_reader", 
    2930    ".pdh": "anton_paar_saxs_reader" 
  • 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.