Changeset 42 for 1dwg

May 19, 2008 3:47:36 PM (12 years ago)

describe better what the IgorPro? XML reader does and how the data is structured in IgorPro?

1 edited


  • 1dwg/trunk/IgorPro/

    r41 r42  
    104104<nowiki>...\Wavemetrics\Igor Pro Folder\Igor Extensions</nowiki>.  
     106== What it does == 
     108Given an XML file, '''CS_XmlReader(fileName)''' attempts to open the file 
     109and read its contents as if it conformed to the canSAS XML standard for 
     110reduced 1-D SAS data (cansas1d/1.0, also known as SASXML).  If the file is  
     111found to be non-conforming, then '''CS_XmlReader(fileName)''' returns with an 
     112error code (show below), otherwise it returns '''0''' that indicates ''no error''. 
     113All data read by this code is left in the IgorPro data folder  
     114'''''root:Packages:CS_XMLreader''''' for pickup by the calling routine. 
     115(Two examples are provided to show how a routine might retrieve the data.) 
     117After opening the XML file (with a file identifier ''fileID''), control is  
     118passed to '''CS_1i_parseXml(fileID)''' which then walks through the XML 
     119elements.  For each '''SASentry''' in the file, a new data folder is created 
     120with the name derived from the Title element (or best effort determination). 
     121Efforts are taken to avoid duplication of data folder names (using standard  
     122IgorPro routines).  For '''SASentry''' elements that contain  more than one SASdata 
     123element, a '''SASdata''' folder is created for each and the corresponding ''I(Q)''  
     124is placed in that subfolder.  When only one '''SASdata''' is found, the ''I(Q)'' 
     125data is placed in the main ''Title'' folder. 
     127=== data columns === 
     129Each column of data in the '''SASdata/Idata/*''' table is placed into a single 
     130IgorPro wave.  At present, the code does not check for non-standard data columns. 
     131(The capability is built into the code but is deactivated at present). 
     133=== metadata === 
     135Additional metadata is collected into a single text wave (''metadata'') where the first column 
     136is an identifier (or ''key'') and the second identifier is the ''value''.  Only 
     137those keys with non-empty values are retained in the metadata table. 
     138'''CAUTION:''' The ''values'' are not checked for characters that may cause trouble when 
     139placed in a wave note.  This will be the responsibility of the calling routine 
     140to ''clean these up'' if the need arises. 
     142The code checks for most metadata elements and will check for repeated elements 
     143where the standard permits. 
     145Here is an example of the metadata for the [[cansas1d_casestudy_collagen | ''cs_collagen_full.xml'']] data: 
     147{| {{Tablestyle}} 
     149! {{Headcellstyle}} | ''i'' (''row'') 
     150! {{Headcellstyle}} | metadata[''i''][0] (''key'') 
     151! {{Headcellstyle}} | metadata[''i''][1] (''value'') 
     153|| 0 
     154|| xmlFile 
     155|| cs_collagen_full.xml 
     157|| 1 
     158|| namespace 
     159|| cansas1d/1.0 
     161|| 2 
     162|| Title 
     163|| dry chick collagen, d = 673 A, 6531 eV, X6B 
     165|| 3 
     166|| Run 
     167|| Sep 19 1994     01:41:02 am 
     169|| 4 
     170|| SASsample/ID 
     171|| dry chick collagen, d = 673 A, 6531 eV, X6B 
     173|| 5 
     174|| SASinstrument/name 
     175|| X6B, NSLS, BNL 
     177|| 6 
     178|| SASinstrument/SASsource/radiation 
     179|| X-ray synchrotron 
     181|| 7 
     182|| SASinstrument/SASsource/wavelength 
     183|| 1.898 
     185|| 8 
     186|| SASinstrument/SASsource/wavelength/@unit 
     187|| A 
     189|| 9 
     190|| SASinstrument/SASdetector/@name 
     191|| X6B PSD 
     193|| 10 
     194|| SASnote 
     195|| <pre>Sep 19 1994     01:41:02 am     Elt: 00090 Seconds  
     196ID: No spectrum identifier defined 
     197Memory Size: 8192 Chls  Conversion Gain: 1024  Adc Offset: 0000 Chls 
     199dry chick collagen, d = 673 A 
     2006531 eV, X6B</pre> 
     204=== XML foreign namespace elements === 
     206These are ignored at this time. 
     208=== XML namespace and header === 
     210The routine does a ''best-efforts'' check to ensure that the given 
     211XML file conforms to the [[cansas1d_documentation#Required_XML_file_header | 
     212required XML file header]].  If you take a minimalist view (''a.k.a.'' a shortcut), 
     213it is likely that your file may be refused by this and other readers.   
     214Pay particular attention to  
     215UPPER/lower case in the text '''cansas1d/1.0''' as this is a '''key component''' used to 
     216index through the XML file. 
    107218==  List of Functions  == 
Note: See TracChangeset for help on using the changeset viewer.