cansas1d documentation: Difference between revisions
Line 219: | Line 219: | ||
* '''Documentation''': [[cansas1d_documentation]] (this page) | * '''Documentation''': [[cansas1d_documentation]] (this page) | ||
* '''Definitions''': [[cansas1d_definition_of_terms]] | * '''Definitions''': [[cansas1d_definition_of_terms]] | ||
* '''Block diagrams''': [[ | * '''Block diagrams''': [[cansas1d_block_diagrams]] | ||
== XML Schema == | == XML Schema == | ||
'''XML Schema''': defines the rules for the XML file format ([http://svn.smallangles.net/trac/canSAS/browser/1dwg/trunk/cansas1d.xsd TRAC], [http://svn.smallangles.net/svn/canSAS/1dwg/trunk/cansas1d.xsd SVN]) and is used to validate | |||
any XML file for adherence to the format. | |||
== XML Stylesheets == | == XML Stylesheets == | ||
Line 258: | Line 258: | ||
* '''TRAC''': [http://svn.smallangles.net/trac/canSAS/browser/1dwg/trunk http://svn.smallangles.net/trac/canSAS/browser/1dwg/trunk] | * '''TRAC''': [http://svn.smallangles.net/trac/canSAS/browser/1dwg/trunk http://svn.smallangles.net/trac/canSAS/browser/1dwg/trunk] | ||
* '''Subversion''': [http://svn.smallangles.net/svn/canSAS/1dwg http://svn.smallangles.net/svn/canSAS/1dwg] <br />(<nowiki>svn checkout http://svn.smallangles.net/svn/canSAS/1dwg/trunk/ cansas-1dwg</nowiki>) | * '''Subversion''': [http://svn.smallangles.net/svn/canSAS/1dwg http://svn.smallangles.net/svn/canSAS/1dwg] <br />(<nowiki>svn checkout http://svn.smallangles.net/svn/canSAS/1dwg/trunk/ cansas-1dwg</nowiki>) | ||
= Validation of XML against the Schema = | = Validation of XML against the Schema = |
Revision as of 22:25, 30 April 2008
Disclaimer
This description is meant to inform the community how to layout the information within the XML files. However, should the information in this document and the cansas1d/1.0 SAS XML Schema differ, the XML Schema will be deemed to have the most correct description of the standard.
General Layout of the XML Data
overview
The basic elements of the cansas1d/1.0 standard are shown in the following table. After an XML header, the root element of the file is SASroot which contains one or more SASentry elements, each of which describes a single experiment (data set, time-slice, step in a series, new sample, etc.). Details of the SASentry element are also shown in the next figure. Refer to the block diagrams for alternative depictions. See cansas1d.xml for an example XML file. Examples, Case Studies, and other background information are below. More discussion can be found on the canSAS 1D Data Formats Working Group page and its discussion page. Details about each specific field (XPath string, XML elements and attributes) are described on the cansas1d_definition_of_terms page.
- SASroot: the root element of the file (after the XML header)
- SASentry: describes a single experiment (data set, time-slice, step in a series, new sample, etc.)
- block diagrams
- cansas1d.xml example XML file
- discussion of this format: basic more
- Seek outside help for XML
- Definition of terms: Details about each specific field (XPath string, XML elements and attributes)
Basic elements of the cansas1d/1.0 standard
element | description | |
---|---|---|
descriptive info required at the start of every XML file | ||
data set, time-slice, step in a series, new sample, etc. | ||
|
for this particular SASentry | |
|
run number or ID number of experiment | |
any non-cansas1d/1.0 element can be used at this point | ||
this is where the reduced 1-D SAS data is stored | ||
a single data point in the dataset | ||
any non-cansas1d/1.0 element can be used at this point | ||
description of the sample | ||
description of the instrument | ||
description of the source | ||
description of the collimation | ||
description of the detector | ||
for each processing or analysis step | ||
anything at all |
required XML file header
<?xml version="1.0"?> <?xml-stylesheet type="text/xsl" href="example.xsl" ?> <SASroot version="1.0" xmlns="cansas1d/1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="cansas1d/1.0 http://svn.smallangles.net/svn/canSAS/1dwg/trunk/cansas1d.xsd" >
Rules
- canSAS1d/1.0 XML data files will adhere to the standard if they can successfully validate against the established XML Schema (cansas1d.xsd)
- Q=(4 π / λ) sin(θ)
where λ is the wavelength of the radiation and 2θ is the angle through which the detected radiation has been scattered. - units to be given in standard SI abbreviations (eg, m, cm, mm, nm, K) with the following exceptions:
- um=micrometres
- C=celsius
- A=Angstroms
- percent=%.
- fraction
- a.u.=arbitrary units
- none=no units are relevant (such as dimensionless)
- where reciprocal units need to be quoted the format shall be "1/abbreviation"
- when raised to a power, use similar to "A^3" or "1/m^4" (and not "A3" or "m-4")
- axes:
- z is along the flight path (positive value in the direction of the detector)
- x is orthogonal to z in the horizontal plane (positive values increase to the right when viewed towards the incoming radiation)
- y is orthogonal to z and x in the vertical plane (positive values increase upwards)
- orientation (angles):
- roll is about z
- pitch is about x
- yaw is about y
- Unicode characters MUST NOT be used
- Binary data is not supported
Compatibility of Geometry Definitions
Note: translation and orientation geometry used by canSAS are consistent with:
- http://en.wikipedia.org/wiki/Cartesian_coordinate_system
- http://en.wikipedia.org/wiki/Right-hand_rule
- http://www.nexusformat.org/Coordinate_Systems
- http://mcstas.risoe.dk/documentation/tutorial/node6.html
- http://webhost5.nts.jhu.edu/reza/book/kinematics/kinematics.htm
The translation and orientation geometry definitions used here are different than those used by SHADOW (http://www.nanotech.wisc.edu/shadow/) where the y and z axes are swapped and the direction of x is changed.
XML layout for multiple experiments
Each experiment is described with a single SASentry element. The fragment below shows how multiple experiments can be included in a single XML file. Full examples of canSAS XML files with multiple experiments include:
<?xml version="1.0"?> <?xml-stylesheet type="text/xsl" href="example.xsl" ?> <SASroot version="1.0" xmlns="cansas1d/1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="cansas1d/1.0 http://svn.smallangles.net/svn/canSAS/1dwg/trunk/cansas1d.xsd" > <SASentry name="071121.dat#S22"> <!-- contents of the first experiment in the file go here --> </SASentry> <SASentry name="example temperature series"> <!-- example with two SAS data sets related to the same sample --> <Title>title of this series</Title> <Run name="run1">42-001</Run> <Run name="run2">42-002</Run> <SASdata name="run1"> <!-- data from 42-001 run comes here --> </SASdata> <SASdata name="run2"> <!-- data from 42-002 run comes here --> </SASdata> <!-- other elements come here for this entry --> </SASentry> <SASentry name="other sample"> <!-- any number of additional experiments can be included, as desired --> <!-- SASentry elements in the same XML file do not have to be related --> </SASentry> </SASroot>
Documentation and Definitions
- Documentation: cansas1d_documentation (this page)
- Definitions: cansas1d_definition_of_terms
- Block diagrams: cansas1d_block_diagrams
XML Schema
XML Schema: defines the rules for the XML file format (TRAC, SVN) and is used to validate any XML file for adherence to the format.
XML Stylesheets
- example.xsl: XSLT stylesheets can be used to extract metadata or to convert into another file format. The default canSAS stylesheet [| example.xsl] should be copied into the each folder with canSAS XML data file(s). It can be used to display the data in a supporting WWW browser (such as Firefox or Internet Explorer) or to import into Microsoft Excel (with the added XML support in Excel). By default, MS Windows binds *.xml files to start Internet Explorer. Double-clicking on a canSAS XML data file with the example.xsl stylesheet in the same directory will produce a WWW page with the SAS data and selected metadata.
Foreign Elements
Examples and Case Studies
- cansas1d.xml basic example: Note that, for clarity, only one row of data is shown. This is probably a very good example to use as a starting point for creating XML files with a text editor.
- bimodal-test1.xml: Simulated SAS data to test size distribution calculation routines.
- dry chick collagen: illustrates the minimum information necessary to meet the requirements of the standard format
- AF1410 steel: SANS study using magnetic contrast variation (with multiple samples and multiple data sets for each sample), the files can be viewed from TRAC (no description yet): http://svn.smallangles.net/trac/canSAS/browser/1dwg/trunk/examples/af1410/
- cansas1d-template.xml: This is used to test all the rules in the XML Schema. This is probably not a very good example to use as a starting point for creating XML files with a text editor since it tests many of the special-case rules.
Support tools for Visualization & Analysis software
IgorPro
An import/export tool for IgorPro has been created (cansasXML.ipf). You can check out the IgorPro working directory from the SVN server (see below).
As of 2008-03-14,
- test suite of XML files developed
- the support can import the XML files into IgorPro
- Development of a GUI (to support the Irena package) has begun
- Development to add export capabilities (from IgorPro) back to the cansas1d/1.0 format has begun
Software repositories
- TRAC: http://svn.smallangles.net/trac/canSAS/browser/1dwg/trunk
- Subversion: http://svn.smallangles.net/svn/canSAS/1dwg
(svn checkout http://svn.smallangles.net/svn/canSAS/1dwg/trunk/ cansas-1dwg)
Validation of XML against the Schema
- open browser to: http://www.xmlvalidation.com/
- paste content of candidate XML file (with reference in the header to the XML Schema as shown above) into the form
- press <validate>
- paste content of cansas1d.xsd XSD file into form and press <continue validation>
- check the results
Help for XML
- XML
- EXtensible Markup Language
http://www.w3schools.com/xml/
http://www.w3.org/XML/
http://en.wikipedia.org/wiki/XML
http://www.zvon.org/xxl/XPathTutorial/General/examples.html - XSL (or XSLT)
- EXtensible Stylesheet Language
http://www.w3schools.com/xsl/
http://www.w3.org/Style/XSL/
http://en.wikipedia.org/wiki/Extensible_Stylesheet_Language
http://en.wikipedia.org/wiki/XSLT - XPath
- XPath is a language for finding information in an XML document.
http://www.w3schools.com/xpath/
http://www.w3.org/Style/XSL/
http://en.wikipedia.org/wiki/XPath - Schema
- An XML Schema describes the structure of an XML document.
http://www.w3schools.com/schema/
http://www.w3.org/XML/Schema
http://en.wikipedia.org/wiki/XSD - XML Namespaces
- XML namespaces are used for providing uniquely named elements and attributes in an XML instance.
http://www.zvon.org/xxl/NamespaceTutorial/Output
http://en.wikipedia.org/wiki/XML_namespaces
http://www.w3schools.com/XML/xml_namespaces.asp