Changeset 788d4c3 in sasview for src/sas/dataloader/readers
- Timestamp:
- Mar 2, 2015 1:25:50 PM (10 years ago)
- 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.1.1, release-4.1.2, release-4.2.2, release_4.0.1, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
- Children:
- c43e875
- Parents:
- 26d2d88
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/dataloader/readers/cansas_constants.py
r79492222 r788d4c3 3 3 the cansas_reader.py file to read in any version of the cansas format. 4 4 """ 5 class CansasConstants :5 class CansasConstants(object): 6 6 """ 7 7 The base class to define where all of the data is to be saved by 8 8 cansas_reader.py. 9 9 """ 10 11 10 names = '' 12 11 format = '' 13 14 12 15 13 def __init__(self): 16 14 self.names = self.CANSAS_NS 17 15 self.format = self.CANSAS_FORMAT 18 19 16 20 17 def iterate_namespace(self, namespace): 21 18 """ 22 19 Method to iterate through a cansas constants tree based on a list of 23 20 names 24 21 25 22 :param namespace: A list of names that match the tree structure of 26 23 cansas_constants … … 46 43 return_me.current_level.get("units_required", "") 47 44 # Where are how to store the variable for the given 48 # namespace CANSAS_CONSTANTS tree is hierarchical, so 45 # namespace CANSAS_CONSTANTS tree is hierarchical, so 49 46 # is no value, inherit 50 47 return_me.ns_variable = cl_variable if cl_variable != "" \ … … 59 56 return_me.ns_datatype = "content" 60 57 return_me.ns_optional = True 61 return return_me 62 63 58 return return_me 59 64 60 def get_namespace_map(self): 65 61 """ … … 67 63 """ 68 64 return self.names 69 70 65 71 66 # CANSAS_NS holds the base namespace and default schema file information 72 CANSAS_NS = { 73 "1.0" : 74 { 75 "ns" : "cansas1d/1.0", 76 "schema" : "cansas1d_v1_0.xsd" 77 }, 78 "1.1" : 79 { 80 "ns" : "urn:cansas1d:1.1", 81 "schema" : "cansas1d_v1_1.xsd" 82 } 67 CANSAS_NS = {"1.0" : { 68 "ns" : "cansas1d/1.0", 69 "schema" : "cansas1d_v1_0.xsd" 70 }, 71 "1.1" : { 72 "ns" : "urn:cansas1d:1.1", 73 "schema" : "cansas1d_v1_1.xsd" 74 } 83 75 } 84 85 76 86 77 # The constants below hold information on where to store the CanSAS data 87 78 # when loaded in using sasview … … 93 84 TITLE = {"variable" : "{0}.title = \"{1}\""} 94 85 SASNOTE = {"variable" : "{0}.notes.append(\'{1}\')"} 95 SASPROCESS_TERM = { 96 "variable" : None, 97 "attributes" : 98 { 99 "unit" : {"variable" : None}, 100 "name" : {"variable" : None} 101 } 102 } 103 SASPROCESS_SASPROCESSNOTE = { 104 "variable" : None, 86 SASPROCESS_TERM = {"variable" : None, 87 "attributes" : { 88 "unit" : {"variable" : None}, 89 "name" : {"variable" : None} 90 } 91 } 92 SASPROCESS_SASPROCESSNOTE = {"variable" : None, 105 93 "children" : {"<any>" : ANY} 106 94 } 107 SASPROCESS = { 108 "variable" : None, 109 "children" : { 110 "name" : {"variable" : "{0}.name = \'{1}\'"}, 111 "date" : {"variable" : "{0}.date = \'{1}\'"}, 112 "description" : 113 {"variable" : "{0}.description = \'{1}\'"}, 114 "term" : SASPROCESS_TERM, 115 "SASprocessnote" : SASPROCESS_SASPROCESSNOTE, 116 "<any>" : ANY 117 }, 118 } 119 RUN = { 120 "variable" : "{0}.run.append(\"{1}\")", 121 "attributes" : 122 {"name" : {"variable" : "{0}.run_name[node_value] = \"{1}\""}} 95 SASPROCESS = {"variable" : None, 96 "children" : {"name" : {"variable" : "{0}.name = \'{1}\'"}, 97 "date" : {"variable" : "{0}.date = \'{1}\'"}, 98 "description" : {"variable" : "{0}.description = \'{1}\'"}, 99 "term" : SASPROCESS_TERM, 100 "SASprocessnote" : SASPROCESS_SASPROCESSNOTE, 101 "<any>" : ANY 102 }, 103 } 104 RUN = {"variable" : "{0}.run.append(\"{1}\")", 105 "attributes" : {"name" : {"variable" : "{0}.run_name[node_value] = \"{1}\""}} 123 106 } 124 SASDATA_IDATA_Q = { 125 "variable" : "{0}.x = numpy.append({0}.x, {1})", 107 SASDATA_IDATA_Q = {"variable" : "{0}.x = numpy.append({0}.x, {1})", 126 108 "unit" : "x_unit", 127 "attributes" : 128 { 129 "unit" : 130 { 131 "variable" : "{0}._xunit = \"{1}\"", 132 "storeas" : "content" 133 } 134 }, 135 } 136 SASDATA_IDATA_I = { 137 "variable" : "{0}.y = numpy.append({0}.y, {1})", 109 "attributes" : {"unit" : { 110 "variable" : "{0}._xunit = \"{1}\"", 111 "storeas" : "content" 112 } 113 }, 114 } 115 SASDATA_IDATA_I = {"variable" : "{0}.y = numpy.append({0}.y, {1})", 138 116 "unit" : "y_unit", 139 "attributes" : 140 { 141 "unit" : 142 { 143 "variable" : "{0}._yunit = \"{1}\"", 144 "storeas" : "content" 145 } 146 }, 147 } 148 SASDATA_IDATA_IDEV = { 149 "variable" : "{0}.dy = numpy.append({0}.dy, {1})", 117 "attributes" : {"unit" : { 118 "variable" : "{0}._yunit = \"{1}\"", 119 "storeas" : "content" 120 } 121 }, 122 } 123 SASDATA_IDATA_IDEV = {"variable" : "{0}.dy = numpy.append({0}.dy, {1})", 150 124 "unit" : "y_unit", 151 "attributes" : 152 { 153 "unit" : 154 { 155 "variable" : META_DATA, 156 "storeas" : "content" 157 } 158 }, 159 } 160 SASDATA_IDATA_QDEV = { 161 "variable" : "{0}.dx = numpy.append({0}.dx, {1})", 125 "attributes" : {"unit" : { 126 "variable" : META_DATA, 127 "storeas" : "content" 128 } 129 }, 130 } 131 SASDATA_IDATA_QDEV = {"variable" : "{0}.dx = numpy.append({0}.dx, {1})", 162 132 "unit" : "x_unit", 163 "attributes" : 164 { 165 "unit" : 166 { 167 "variable" : META_DATA, 168 "storeas" : "content" 169 } 170 }, 133 "attributes" : {"unit" : { 134 "variable" : META_DATA, 135 "storeas" : "content" 136 } 137 }, 171 138 } 172 139 SASDATA_IDATA_DQL = {
Note: See TracChangeset
for help on using the changeset viewer.