Ignore:
Timestamp:
Apr 11, 2017 9:51:05 AM (8 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, costrafo411, magnetic_scatt, release-4.2.2, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
Children:
beba407
Parents:
7f75a3f (diff), 97c60f8 (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:
Jeff Krzywon <krzywon@…> (04/11/17 09:51:05)
git-committer:
krzywon <krzywon@…> (04/11/17 09:51:05)
Message:

Merge branch 'master' into ticket-876

# Conflicts:
# src/sas/sascalc/dataloader/readers/ascii_reader.py
# src/sas/sascalc/dataloader/readers/xml_reader.py

File:
1 edited

Legend:

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

    r7f75a3f r278ddee  
    3434import xml.dom.minidom 
    3535from xml.dom.minidom import parseString 
     36 
     37logger = logging.getLogger(__name__) 
    3638 
    3739PREPROCESS = "xmlpreprocess" 
     
    291293                elif tagname == 'Sesans': 
    292294                    self.current_datainfo.isSesans = bool(data_point) 
     295                elif tagname == 'yacceptance': 
     296                    self.current_datainfo.sample.yacceptance = (data_point, unit) 
    293297                elif tagname == 'zacceptance': 
    294298                    self.current_datainfo.sample.zacceptance = (data_point, unit) 
     
    809813        :param data1d: presumably a Data1D object 
    810814        """ 
    811         if self.current_dataset == None: 
     815        if self.current_dataset is None: 
    812816            x_vals = np.empty(0) 
    813817            y_vals = np.empty(0) 
     
    897901        # Write the file 
    898902        file_ref = open(filename, 'w') 
    899         if self.encoding == None: 
     903        if self.encoding is None: 
    900904            self.encoding = "UTF-8" 
    901905        doc.write(file_ref, encoding=self.encoding, 
     
    10171021        :param entry_node: lxml node ElementTree object to be appended to 
    10181022        """ 
    1019         if datainfo.run == None or datainfo.run == []: 
     1023        if datainfo.run is None or datainfo.run == []: 
    10201024            datainfo.run.append(RUN_NAME_DEFAULT) 
    10211025            datainfo.run_name[RUN_NAME_DEFAULT] = RUN_NAME_DEFAULT 
     
    10611065            sesans.text = str(datainfo.isSesans) 
    10621066            node.append(sesans) 
     1067            self.write_node(node, "yacceptance", datainfo.sample.yacceptance[0], 
     1068                             {'unit': datainfo.sample.yacceptance[1]}) 
    10631069            self.write_node(node, "zacceptance", datainfo.sample.zacceptance[0], 
    10641070                             {'unit': datainfo.sample.zacceptance[1]}) 
     
    11331139                self.write_node(point, "T", spectrum.transmission[i], 
    11341140                                {'unit': spectrum.transmission_unit}) 
    1135                 if spectrum.transmission_deviation != None \ 
     1141                if spectrum.transmission_deviation is not None \ 
    11361142                and len(spectrum.transmission_deviation) >= i: 
    11371143                    self.write_node(point, "Tdev", 
     
    12131219                                 str(datainfo.source.name)) 
    12141220        self.append(source, instr) 
    1215         if datainfo.source.radiation == None or datainfo.source.radiation == '': 
     1221        if datainfo.source.radiation is None or datainfo.source.radiation == '': 
    12161222            datainfo.source.radiation = "neutron" 
    12171223        self.write_node(source, "radiation", datainfo.source.radiation) 
     
    12541260        :param instr: lxml node ElementTree object to be appended to 
    12551261        """ 
    1256         if datainfo.collimation == [] or datainfo.collimation == None: 
     1262        if datainfo.collimation == [] or datainfo.collimation is None: 
    12571263            coll = Collimation() 
    12581264            datainfo.collimation.append(coll) 
     
    12991305        :param inst: lxml instrument node to be appended to 
    13001306        """ 
    1301         if datainfo.detector == None or datainfo.detector == []: 
     1307        if datainfo.detector is None or datainfo.detector == []: 
    13021308            det = Detector() 
    13031309            det.name = "" 
     
    14641470                local_unit = None 
    14651471                exec "local_unit = storage.%s_unit" % toks[0] 
    1466                 if local_unit != None and units.lower() != local_unit.lower(): 
     1472                if local_unit is not None and units.lower() != local_unit.lower(): 
    14671473                    if HAS_CONVERTER == True: 
    14681474                        try: 
     
    14771483                            self.errors.add(err_mess) 
    14781484                            if optional: 
    1479                                 logging.info(err_mess) 
     1485                                logger.info(err_mess) 
    14801486                            else: 
    14811487                                raise ValueError, err_mess 
     
    14861492                        self.errors.add(err_mess) 
    14871493                        if optional: 
    1488                             logging.info(err_mess) 
     1494                            logger.info(err_mess) 
    14891495                        else: 
    14901496                            raise ValueError, err_mess 
Note: See TracChangeset for help on using the changeset viewer.