Changeset c43e875 in sasview
- Timestamp:
- Mar 2, 2015 2:26:45 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:
- e4f421c
- Parents:
- 788d4c3
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/dataloader/readers/cansas_constants.py
r788d4c3 rc43e875 65 65 66 66 # CANSAS_NS holds the base namespace and default schema file information 67 CANSAS_NS = {"1.0" : { 68 "ns" : "cansas1d/1.0", 69 "schema" : "cansas1d_v1_0.xsd" 67 CANSAS_NS = {"1.0" : {"ns" : "cansas1d/1.0", 68 "schema" : "cansas1d_v1_0.xsd" 70 69 }, 71 "1.1" : { 72 "ns" : "urn:cansas1d:1.1", 73 "schema" : "cansas1d_v1_1.xsd" 74 } 75 } 70 "1.1" : {"ns" : "urn:cansas1d:1.1", 71 "schema" : "cansas1d_v1_1.xsd" 72 } 73 } 76 74 77 75 # The constants below hold information on where to store the CanSAS data 78 76 # when loaded in using sasview 79 77 META_DATA = "{0}.meta_data[\"{2}\"] = \"{1}\"" 80 ANY = { 81 "variable" : "{0}.meta_data[\"{2}\"] = \'{1}\'", 78 ANY = {"variable" : "{0}.meta_data[\"{2}\"] = \'{1}\'", 82 79 "storeas" : "content", 83 80 } 84 81 TITLE = {"variable" : "{0}.title = \"{1}\""} 85 82 SASNOTE = {"variable" : "{0}.notes.append(\'{1}\')"} 86 83 SASPROCESS_TERM = {"variable" : None, 87 "attributes" : { 88 "unit" : {"variable" : None}, 84 "attributes" : {"unit" : {"variable" : None}, 89 85 "name" : {"variable" : None} 90 91 86 } 87 } 92 88 SASPROCESS_SASPROCESSNOTE = {"variable" : None, 93 89 "children" : {"<any>" : ANY} 94 90 } 95 91 SASPROCESS = {"variable" : None, 96 92 "children" : {"name" : {"variable" : "{0}.name = \'{1}\'"}, 97 93 "date" : {"variable" : "{0}.date = \'{1}\'"}, 98 "description" : {"variable" : "{0}.description = \'{1}\'"}, 94 "description" : 95 {"variable" : "{0}.description = \'{1}\'"}, 99 96 "term" : SASPROCESS_TERM, 100 97 "SASprocessnote" : SASPROCESS_SASPROCESSNOTE, 101 98 "<any>" : ANY 102 103 99 }, 100 } 104 101 RUN = {"variable" : "{0}.run.append(\"{1}\")", 105 "attributes" : {"name" : {"variable" : "{0}.run_name[node_value] = \"{1}\""}} 106 } 102 "attributes" : {"name" : 103 {"variable" : "{0}.run_name[node_value] = \"{1}\""}} 104 } 107 105 SASDATA_IDATA_Q = {"variable" : "{0}.x = numpy.append({0}.x, {1})", 108 106 "unit" : "x_unit", 109 "attributes" : {"unit" : {110 111 112 113 114 107 "attributes" : {"unit" : 108 {"variable" : "{0}._xunit = \"{1}\"", 109 "storeas" : "content" 110 } 111 }, 112 } 115 113 SASDATA_IDATA_I = {"variable" : "{0}.y = numpy.append({0}.y, {1})", 116 114 "unit" : "y_unit", 117 "attributes" : {"unit" : {118 119 120 121 122 115 "attributes" : {"unit" : 116 {"variable" : "{0}._yunit = \"{1}\"", 117 "storeas" : "content" 118 } 119 }, 120 } 123 121 SASDATA_IDATA_IDEV = {"variable" : "{0}.dy = numpy.append({0}.dy, {1})", 124 122 "unit" : "y_unit", 125 "attributes" : {"unit" : {126 127 128 129 130 123 "attributes" : {"unit" : 124 {"variable" : META_DATA, 125 "storeas" : "content" 126 } 127 }, 128 } 131 129 SASDATA_IDATA_QDEV = {"variable" : "{0}.dx = numpy.append({0}.dx, {1})", 132 130 "unit" : "x_unit", 133 "attributes" : {"unit" : { 134 "variable" : META_DATA, 135 "storeas" : "content" 136 } 137 }, 138 } 139 SASDATA_IDATA_DQL = { 140 "variable" : "{0}.dxl = numpy.append({0}.dxl, {1})", 131 "attributes" : {"unit" : 132 {"variable" : META_DATA, 133 "storeas" : "content" 134 } 135 }, 136 } 137 SASDATA_IDATA_DQL = {"variable" : "{0}.dxl = numpy.append({0}.dxl, {1})", 141 138 "unit" : "x_unit", 142 "attributes" : 143 { 144 "unit" : 145 { 146 "variable" : META_DATA, 147 "storeas" : "content" 148 } 149 }, 150 } 151 SASDATA_IDATA_DQW = { 152 "variable" : "{0}.dxw = numpy.append({0}.dxw, {1})", 139 "attributes" : {"unit" : 140 {"variable" : META_DATA, 141 "storeas" : "content" 142 } 143 }, 144 } 145 SASDATA_IDATA_DQW = {"variable" : "{0}.dxw = numpy.append({0}.dxw, {1})", 153 146 "unit" : "x_unit", 154 "attributes" : 155 { 156 "unit" : 157 { 158 "variable" : META_DATA, 159 "storeas" : "content" 160 } 161 }, 162 } 163 SASDATA_IDATA_QMEAN = { 164 "storeas" : "content", 147 "attributes" : {"unit" : 148 {"variable" : META_DATA, 149 "storeas" : "content" 150 } 151 }, 152 } 153 SASDATA_IDATA_QMEAN = {"storeas" : "content", 165 154 "unit" : "x_unit", 166 155 "variable" : META_DATA, 167 156 "attributes" : {"unit" : {"variable" : META_DATA}}, 168 } 169 SASDATA_IDATA_SHADOWFACTOR = { 170 "variable" : META_DATA, 157 } 158 SASDATA_IDATA_SHADOWFACTOR = {"variable" : META_DATA, 171 159 "storeas" : "content", 172 } 173 SASDATA_IDATA = { 174 "storeas" : "float", 160 } 161 SASDATA_IDATA = {"storeas" : "float", 175 162 "units_optional" : False, 176 163 "variable" : None, 177 "attributes" : { 178 "name" : { 179 "variable" : META_DATA, 164 "attributes" : {"name" : {"variable" : META_DATA, 180 165 "storeas" : "content", 181 }, 182 "timestamp" : { 183 "variable" : META_DATA, 166 }, 167 "timestamp" : {"variable" : META_DATA, 184 168 "storeas" : "timestamp", 185 } 186 }, 187 "children" : { 188 "Q" : SASDATA_IDATA_Q, 169 } 170 }, 171 "children" : {"Q" : SASDATA_IDATA_Q, 189 172 "I" : SASDATA_IDATA_I, 190 173 "Idev" : SASDATA_IDATA_IDEV, … … 195 178 "Shadowfactor" : SASDATA_IDATA_SHADOWFACTOR, 196 179 "<any>" : ANY 197 } 198 } 199 SASDATA = { 200 "attributes" : {"name" : {"variable" : META_DATA,}}, 180 } 181 } 182 SASDATA = {"attributes" : {"name" : {"variable" : META_DATA,}}, 201 183 "variable" : None, 202 "children" : { 203 "Idata" : SASDATA_IDATA, 184 "children" : {"Idata" : SASDATA_IDATA, 204 185 "<any>" : ANY 205 } 206 } 207 SASTRANSSPEC_TDATA_LAMDBA = { 208 "variable" : "{0}.wavelength.append({1})", 186 } 187 } 188 SASTRANSSPEC_TDATA_LAMDBA = {"variable" : "{0}.wavelength.append({1})", 209 189 "unit" : "wavelength_unit", 210 "attributes" : 211 { 212 "unit" : 213 { 214 "variable" : \ 215 "{0}.wavelength_unit = \"{1}\"", 190 "attributes" : 191 {"unit" : 192 {"variable" : "{0}.wavelength_unit = \"{1}\"", 216 193 "storeas" : "content" 217 }218 194 } 219 195 } 220 SASTRANSSPEC_TDATA_T = {221 196 } 197 SASTRANSSPEC_TDATA_T = {"variable" : "{0}.transmission.append({1})", 222 198 "unit" : "transmission_unit", 223 "attributes" : 224 { 225 "unit" : 226 { 227 "variable" : "{0}.transmission_unit = \"{1}\"", 199 "attributes" : 200 {"unit" : 201 {"variable" : "{0}.transmission_unit = \"{1}\"", 228 202 "storeas" : "content" 229 }230 203 } 231 204 } 232 SASTRANSSPEC_TDATA_TDEV = {233 "variable" : \234 205 } 206 SASTRANSSPEC_TDATA_TDEV = {"variable" : 207 "{0}.transmission_deviation.append({1})", 235 208 "unit" : "transmission_deviation_unit", 236 209 "attributes" : 237 { 238 "unit" : 239 { 240 "variable" : \ 241 "{0}.transmission_deviation_unit = \"{1}\"", 210 {"unit" : 211 {"variable" : 212 "{0}.transmission_deviation_unit = \"{1}\"", 242 213 "storeas" : "content" 243 }244 214 } 245 215 } 246 SASTRANSSPEC_TDATA = {247 216 } 217 SASTRANSSPEC_TDATA = {"storeas" : "float", 248 218 "variable" : None, 249 "children" : { 250 "Lambda" : SASTRANSSPEC_TDATA_LAMDBA, 219 "children" : {"Lambda" : SASTRANSSPEC_TDATA_LAMDBA, 251 220 "T" : SASTRANSSPEC_TDATA_T, 252 221 "Tdev" : SASTRANSSPEC_TDATA_TDEV, 253 222 "<any>" : ANY, 254 } 255 } 256 SASTRANSSPEC = { 257 "variable" : None, 258 "children" : { 259 "Tdata" : SASTRANSSPEC_TDATA, 223 } 224 } 225 SASTRANSSPEC = {"variable" : None, 226 "children" : {"Tdata" : SASTRANSSPEC_TDATA, 260 227 "<any>" : ANY, 261 }, 262 "attributes" : 263 { 264 "name" : 265 { 266 "variable" : "{0}.name = \"{1}\""}, 267 "timestamp" : 268 { 269 "variable" : "{0}.timestamp = \"{1}\"" 270 }, 271 } 228 }, 229 "attributes" : 230 {"name" : 231 {"variable" : "{0}.name = \"{1}\""}, 232 "timestamp" : 233 {"variable" : "{0}.timestamp = \"{1}\""}, 272 234 } 273 SASSAMPLE_THICK = {274 235 } 236 SASSAMPLE_THICK = {"variable" : "{0}.sample.thickness = {1}", 275 237 "unit" : "sample.thickness_unit", 276 238 "storeas" : "float", 277 "attributes" : 278 { 279 "unit" : 280 { 281 "variable" : "{0}.sample.thickness_unit = \"{1}\"", 239 "attributes" : 240 {"unit" : 241 {"variable" : "{0}.sample.thickness_unit = \"{1}\"", 282 242 "storeas" : "content" 283 } 284 }, 285 } 286 SASSAMPLE_TRANS = { 287 "variable" : "{0}.sample.transmission = {1}", 243 } 244 }, 245 } 246 SASSAMPLE_TRANS = {"variable" : "{0}.sample.transmission = {1}", 288 247 "storeas" : "float", 289 } 290 SASSAMPLE_TEMP = { 291 "variable" : "{0}.sample.temperature = {1}", 248 } 249 SASSAMPLE_TEMP = {"variable" : "{0}.sample.temperature = {1}", 292 250 "unit" : "sample.temperature_unit", 293 251 "storeas" : "float", 294 "attributes" : 295 { 296 "unit" : 297 { 298 "variable" : "{0}.sample.temperature_unit = \"{1}\"", 252 "attributes" : 253 {"unit" : 254 {"variable" : "{0}.sample.temperature_unit = \"{1}\"", 299 255 "storeas" : "content" 300 } 301 }, 302 } 303 SASSAMPLE_POS_ATTR = { 304 "unit" : { 305 "variable" : \ 306 "{0}.sample.position_unit = \"{1}\"", 307 "storeas" : "content" 308 } 309 } 310 SASSAMPLE_POS_X = { 311 "variable" : "{0}.sample.position.x = {1}", 256 } 257 }, 258 } 259 SASSAMPLE_POS_ATTR = {"unit" : {"variable" : 260 "{0}.sample.position_unit = \"{1}\"", 261 "storeas" : "content" 262 } 263 } 264 SASSAMPLE_POS_X = {"variable" : "{0}.sample.position.x = {1}", 312 265 "unit" : "sample.position_unit", 313 266 "storeas" : "float", 314 267 "attributes" : SASSAMPLE_POS_ATTR 315 } 316 SASSAMPLE_POS_Y = { 317 "variable" : "{0}.sample.position.y = {1}", 268 } 269 SASSAMPLE_POS_Y = {"variable" : "{0}.sample.position.y = {1}", 318 270 "unit" : "sample.position_unit", 319 271 "storeas" : "float", 320 272 "attributes" : SASSAMPLE_POS_ATTR 321 } 322 SASSAMPLE_POS_Z = { 323 "variable" : "{0}.sample.position.z = {1}", 273 } 274 SASSAMPLE_POS_Z = {"variable" : "{0}.sample.position.z = {1}", 324 275 "unit" : "sample.position_unit", 325 276 "storeas" : "float", 326 277 "attributes" : SASSAMPLE_POS_ATTR 327 } 328 SASSAMPLE_POS = { 329 "children" : { 330 "variable" : None, 278 } 279 SASSAMPLE_POS = {"children" : {"variable" : None, 331 280 "x" : SASSAMPLE_POS_X, 332 281 "y" : SASSAMPLE_POS_Y, 333 282 "z" : SASSAMPLE_POS_Z, 334 }, 335 } 336 SASSAMPLE_ORIENT_ATTR = { 337 "unit" : 338 { 339 "variable" : \ 340 "{0}.sample.orientation_unit = \"{1}\"", 283 }, 284 } 285 SASSAMPLE_ORIENT_ATTR = {"unit" : 286 {"variable" : 287 "{0}.sample.orientation_unit = \"{1}\"", 341 288 "storeas" : "content" 342 }343 289 } 344 SASSAMPLE_ORIENT_ROLL = {345 290 } 291 SASSAMPLE_ORIENT_ROLL = {"variable" : "{0}.sample.orientation.x = {1}", 346 292 "unit" : "sample.orientation_unit", 347 293 "storeas" : "float", 348 294 "attributes" : SASSAMPLE_ORIENT_ATTR 295 } 296 SASSAMPLE_ORIENT_PITCH = {"variable" : "{0}.sample.orientation.y = {1}", 297 "unit" : "sample.orientation_unit", 298 "storeas" : "float", 299 "attributes" : SASSAMPLE_ORIENT_ATTR 349 300 } 350 SASSAMPLE_ORIENT_PITCH = { 351 "variable" : "{0}.sample.orientation.y = {1}", 352 "unit" : "sample.orientation_unit", 353 "storeas" : "float", 354 "attributes" : SASSAMPLE_ORIENT_ATTR 355 } 356 SASSAMPLE_ORIENT_YAW = { 357 "variable" : "{0}.sample.orientation.z = {1}", 358 "unit" : "sample.orientation_unit", 359 "storeas" : "float", 360 "attributes" : SASSAMPLE_ORIENT_ATTR 361 } 362 SASSAMPLE_ORIENT = { 363 "variable" : None, 364 "children" : { 365 "roll" : SASSAMPLE_ORIENT_ROLL, 301 SASSAMPLE_ORIENT_YAW = {"variable" : "{0}.sample.orientation.z = {1}", 302 "unit" : "sample.orientation_unit", 303 "storeas" : "float", 304 "attributes" : SASSAMPLE_ORIENT_ATTR 305 } 306 SASSAMPLE_ORIENT = {"variable" : None, 307 "children" : {"roll" : SASSAMPLE_ORIENT_ROLL, 366 308 "pitch" : SASSAMPLE_ORIENT_PITCH, 367 309 "yaw" : SASSAMPLE_ORIENT_YAW, 368 }, 369 } 370 SASSAMPLE = { 371 "attributes" : 372 {"name" : {"variable" : "{0}.sample.name = \"{1}\""},}, 310 }, 311 } 312 SASSAMPLE = {"attributes" : 313 {"name" : {"variable" : "{0}.sample.name = \"{1}\""},}, 373 314 "variable" : None, 374 "children" : { 375 "ID" : {"variable" : "{0}.sample.ID = \"{1}\""}, 315 "children" : {"ID" : {"variable" : "{0}.sample.ID = \"{1}\""}, 376 316 "thickness" : SASSAMPLE_THICK, 377 "transmission" : SASSAMPLE_TRANS, 378 "temperature" : SASSAMPLE_TEMP, 317 "transmission" : SASSAMPLE_TRANS, 318 "temperature" : SASSAMPLE_TEMP, 379 319 "position" : SASSAMPLE_POS, 380 320 "orientation" : SASSAMPLE_ORIENT, 381 "details" : {"variable" : \ 382 "{0}.sample.details.append(\"{1}\")"}, 321 "details" : 322 {"variable" : 323 "{0}.sample.details.append(\"{1}\")"}, 383 324 "<any>" : ANY 384 }, 385 } 386 SASINSTR_SRC_BEAMSIZE_ATTR = { 387 "unit" : \ 388 "{0}.source.beam_size_unit = \"{1}\"", 325 }, 326 } 327 SASINSTR_SRC_BEAMSIZE_ATTR = {"unit" : 328 "{0}.source.beam_size_unit = \"{1}\"", 389 329 "storeas" : "content" 390 } 391 SASINSTR_SRC_BEAMSIZE_X = { 392 "variable" : "{0}.source.beam_size.x = {1}", 330 } 331 SASINSTR_SRC_BEAMSIZE_X = {"variable" : "{0}.source.beam_size.x = {1}", 393 332 "unit" : "source.beam_size_unit", 394 333 "storeas" : "float", 395 334 "attributes" : SASINSTR_SRC_BEAMSIZE_ATTR 396 } 397 SASINSTR_SRC_BEAMSIZE_Y = { 398 "variable" : "{0}.source.beam_size.y = {1}", 335 } 336 SASINSTR_SRC_BEAMSIZE_Y = {"variable" : "{0}.source.beam_size.y = {1}", 399 337 "unit" : "source.beam_size_unit", 400 338 "storeas" : "float", 401 339 "attributes" : SASINSTR_SRC_BEAMSIZE_ATTR 402 } 403 SASINSTR_SRC_BEAMSIZE_Z = { 404 "variable" : "{0}.source.beam_size.z = {1}", 340 } 341 SASINSTR_SRC_BEAMSIZE_Z = {"variable" : "{0}.source.beam_size.z = {1}", 405 342 "unit" : "source.beam_size_unit", 406 343 "storeas" : "float", 407 344 "attributes" : SASINSTR_SRC_BEAMSIZE_ATTR 408 } 409 SASINSTR_SRC_BEAMSIZE = { 410 "attributes" : 411 {"name" : {"variable" : \ 412 "{0}.source.beam_size_name = \"{1}\""}}, 345 } 346 SASINSTR_SRC_BEAMSIZE = {"attributes" : 347 {"name" : {"variable" : 348 "{0}.source.beam_size_name = \"{1}\""}}, 413 349 "variable" : None, 414 "children" : { 415 "x" : SASINSTR_SRC_BEAMSIZE_X, 350 "children" : {"x" : SASINSTR_SRC_BEAMSIZE_X, 416 351 "y" : SASINSTR_SRC_BEAMSIZE_Y, 417 352 "z" : SASINSTR_SRC_BEAMSIZE_Z, 418 } 419 } 420 SASINSTR_SRC_WL = { 421 "variable" : "{0}.source.wavelength = {1}", 353 } 354 } 355 SASINSTR_SRC_WL = {"variable" : "{0}.source.wavelength = {1}", 422 356 "unit" : "source.wavelength_unit", 423 357 "storeas" : "float", 424 "attributes" : 425 { 426 "unit" : 427 { 428 "variable" : "{0}.source.wavelength_unit = \"{1}\"", 358 "attributes" : 359 {"unit" : 360 {"variable" : "{0}.source.wavelength_unit = \"{1}\"", 429 361 "storeas" : "content" 430 }, 431 } 362 }, 432 363 } 433 SASINSTR_SRC_WL_MIN = {434 364 } 365 SASINSTR_SRC_WL_MIN = {"variable" : "{0}.source.wavelength_min = {1}", 435 366 "unit" : "source.wavelength_min_unit", 436 367 "storeas" : "float", 437 "attributes" : 438 { 439 "unit" : 440 { 441 "variable" : \ 442 "{0}.source.wavelength_min_unit = \"{1}\"", 368 "attributes" : 369 {"unit" : 370 {"variable" : 371 "{0}.source.wavelength_min_unit = \"{1}\"", 443 372 "storeas" : "content" 444 }, 445 } 446 } 447 SASINSTR_SRC_WL_MAX = { 448 "variable" : "{0}.source.wavelength_max = {1}", 373 }, 374 } 375 } 376 SASINSTR_SRC_WL_MAX = {"variable" : "{0}.source.wavelength_max = {1}", 449 377 "unit" : "source.wavelength_max_unit", 450 378 "storeas" : "float", 451 "attributes" : 452 { 453 "unit" : 454 { 455 "variable" : \ 456 "{0}.source.wavelength_max_unit = \"{1}\"", 379 "attributes" : 380 {"unit" : 381 {"variable" : 382 "{0}.source.wavelength_max_unit = \"{1}\"", 457 383 "storeas" : "content" 458 }, 459 } 460 } 461 SASINSTR_SRC_WL_SPR = { 462 "variable" : "{0}.source.wavelength_spread = {1}", 384 }, 385 } 386 } 387 SASINSTR_SRC_WL_SPR = {"variable" : "{0}.source.wavelength_spread = {1}", 463 388 "unit" : "source.wavelength_spread_unit", 464 389 "storeas" : "float", 465 "attributes" : 466 { 467 "unit" : 468 { 469 "variable" : \ 470 "{0}.source.wavelength_spread_unit = \"{1}\"", 390 "attributes" : 391 {"unit" : 392 {"variable" : 393 "{0}.source.wavelength_spread_unit = \"{1}\"", 471 394 "storeas" : "content" 472 }, 473 } 474 } 475 SASINSTR_SRC = { 476 "attributes" : {"name" : {"variable" : \ 395 }, 396 } 397 } 398 SASINSTR_SRC = {"attributes" : {"name" : {"variable" : 477 399 "{0}.source.name = \"{1}\""}}, 478 400 "variable" : None, 479 "children" : { 480 "radiation" : {"variable" : \481 401 "children" : {"radiation" : 402 {"variable" : 403 "{0}.source.radiation = \"{1}\""}, 482 404 "beam_size" : SASINSTR_SRC_BEAMSIZE, 483 "beam_shape" : {"variable" : \ 484 "{0}.source.beam_shape = \"{1}\""}, 405 "beam_shape" : 406 {"variable" : 407 "{0}.source.beam_shape = \"{1}\""}, 485 408 "wavelength" : SASINSTR_SRC_WL, 486 409 "wavelength_min" : SASINSTR_SRC_WL_MIN, 487 410 "wavelength_max" : SASINSTR_SRC_WL_MAX, 488 411 "wavelength_spread" : SASINSTR_SRC_WL_SPR, 489 }, 490 } 491 SASINSTR_COLL_APER_ATTR = { 492 "unit" : { 493 "variable" : "{0}.size_unit = \"{1}\"", 412 }, 413 } 414 SASINSTR_COLL_APER_ATTR = {"unit" : {"variable" : "{0}.size_unit = \"{1}\"", 494 415 "storeas" : "content" 495 }, 496 } 497 SASINSTR_COLL_APER_X = { 498 "variable" : "{0}.size.x = {1}", 416 }, 417 } 418 SASINSTR_COLL_APER_X = {"variable" : "{0}.size.x = {1}", 499 419 "unit" : "size_unit", 500 420 "storeas" : "float", 501 421 "attributes" : SASINSTR_COLL_APER_ATTR 502 } 503 SASINSTR_COLL_APER_Y = { 504 "variable" : "{0}.size.y = {1}", 422 } 423 SASINSTR_COLL_APER_Y = {"variable" : "{0}.size.y = {1}", 505 424 "unit" : "size_unit", 506 425 "storeas" : "float", 507 426 "attributes" : SASINSTR_COLL_APER_ATTR 508 } 509 SASINSTR_COLL_APER_Z = { 510 "variable" : "{0}.size.z = {1}", 427 } 428 SASINSTR_COLL_APER_Z = {"variable" : "{0}.size.z = {1}", 511 429 "unit" : "size_unit", 512 430 "storeas" : "float", 513 431 "attributes" : SASINSTR_COLL_APER_ATTR 514 } 515 SASINSTR_COLL_APER_SIZE = { 516 "attributes" : 517 {"unit" : {"variable" : \ 518 "{0}.size_unit = \"{1}\""}}, 519 "children" : { 520 "storeas" : "float", 521 "x" : SASINSTR_COLL_APER_X, 522 "y" : SASINSTR_COLL_APER_Y, 523 "z" : SASINSTR_COLL_APER_Z, 432 } 433 SASINSTR_COLL_APER_SIZE = {"attributes" : 434 {"unit" : {"variable" : 435 "{0}.size_unit = \"{1}\""}}, 436 "children" : {"storeas" : "float", 437 "x" : SASINSTR_COLL_APER_X, 438 "y" : SASINSTR_COLL_APER_Y, 439 "z" : SASINSTR_COLL_APER_Z, 524 440 } 525 } 526 SASINSTR_COLL_APER_DIST = { 527 "storeas" : "float", 528 "attributes" : 529 { 530 "storeas" : "content", 531 "unit" : {"variable" : \ 532 "{0}.distance_unit = \"{1}\""} 533 }, 441 } 442 SASINSTR_COLL_APER_DIST = {"storeas" : "float", 443 "attributes" : 444 {"storeas" : "content", 445 "unit" : {"variable" : 446 "{0}.distance_unit = \"{1}\""} 447 }, 534 448 "variable" : "{0}.distance = {1}", 535 449 "unit" : "distance_unit", 536 } 537 SASINSTR_COLL_APER = { 538 "variable" : None, 539 "attributes" : { 540 "name" : {"variable" : \ 450 } 451 SASINSTR_COLL_APER = {"variable" : None, 452 "attributes" : {"name" : {"variable" : 541 453 "{0}.name = \"{1}\""}, 542 "type" : {"variable" : \454 "type" : {"variable" : 543 455 "{0}.type = \"{1}\""}, 544 }, 545 "children" : { 546 "size" : SASINSTR_COLL_APER_SIZE, 456 }, 457 "children" : {"size" : SASINSTR_COLL_APER_SIZE, 547 458 "distance" : SASINSTR_COLL_APER_DIST 548 } 549 } 550 SASINSTR_COLL = { 551 "attributes" : 459 } 460 } 461 SASINSTR_COLL = {"attributes" : 552 462 {"name" : {"variable" : "{0}.name = \"{1}\""}}, 553 463 "variable" : None, 554 "children" : 555 { 556 "length" : 557 { 558 "variable" : "{0}.length = {1}", 464 "children" : 465 {"length" : 466 {"variable" : "{0}.length = {1}", 559 467 "unit" : "length_unit", 560 468 "storeas" : "float", 561 "attributes" : 562 { 563 "storeas" : "content", 469 "attributes" : 470 {"storeas" : "content", 564 471 "unit" : {"variable" : "{0}.length_unit = \"{1}\""} 472 }, 473 }, 474 "aperture" : SASINSTR_COLL_APER, 475 }, 476 } 477 SASINSTR_DET_SDD = {"variable" : "{0}.distance = {1}", 478 "unit" : "distance_unit", 479 "attributes" : 480 {"unit" : 481 {"variable" : "{0}.distance_unit = \"{1}\"", 482 "storeas" : "content" 483 } 565 484 }, 566 }, 567 "aperture" : SASINSTR_COLL_APER, 568 }, 569 } 570 SASINSTR_DET_SDD = { 571 "variable" : "{0}.distance = {1}", 572 "unit" : "distance_unit", 573 "attributes" : 574 { 575 "unit" : 576 { 577 "variable" : "{0}.distance_unit = \"{1}\"", 578 "storeas" : "content" 579 } 580 }, 581 } 582 SASINSTR_DET_OFF_ATTR = { 583 "unit" : { 584 "variable" : "{0}.offset_unit = \"{1}\"", 585 "storeas" : "content" 485 } 486 SASINSTR_DET_OFF_ATTR = {"unit" : {"variable" : "{0}.offset_unit = \"{1}\"", 487 "storeas" : "content" 586 488 }, 587 489 } 588 SASINSTR_DET_OFF_X = { 589 "variable" : "{0}.offset.x = {1}", 590 "unit" : "offset_unit", 591 "attributes" : SASINSTR_DET_OFF_ATTR 592 } 593 SASINSTR_DET_OFF_Y = { 594 "variable" : "{0}.offset.y = {1}", 595 "unit" : "offset_unit", 596 "attributes" : SASINSTR_DET_OFF_ATTR 597 } 598 SASINSTR_DET_OFF_Z = { 599 "variable" : "{0}.offset.z = {1}", 600 "unit" : "offset_unit", 601 "attributes" : SASINSTR_DET_OFF_ATTR 602 } 603 SASINSTR_DET_OFF = { 604 "variable" : None, 605 "children" : { 606 "x" : SASINSTR_DET_OFF_X, 490 SASINSTR_DET_OFF_X = {"variable" : "{0}.offset.x = {1}", 491 "unit" : "offset_unit", 492 "attributes" : SASINSTR_DET_OFF_ATTR 493 } 494 SASINSTR_DET_OFF_Y = {"variable" : "{0}.offset.y = {1}", 495 "unit" : "offset_unit", 496 "attributes" : SASINSTR_DET_OFF_ATTR 497 } 498 SASINSTR_DET_OFF_Z = {"variable" : "{0}.offset.z = {1}", 499 "unit" : "offset_unit", 500 "attributes" : SASINSTR_DET_OFF_ATTR 501 } 502 SASINSTR_DET_OFF = {"variable" : None, 503 "children" : {"x" : SASINSTR_DET_OFF_X, 607 504 "y" : SASINSTR_DET_OFF_Y, 608 505 "z" : SASINSTR_DET_OFF_Z, 609 } 610 } 611 SASINSTR_DET_OR_ATTR = { 612 "unit" : "{0}.orientation_unit = \"{1}\"", 506 } 507 } 508 SASINSTR_DET_OR_ATTR = {"unit" : "{0}.orientation_unit = \"{1}\"", 613 509 "storeas" : "content" 614 } 615 SASINSTR_DET_OR_ROLL = { 616 "variable" : "{0}.orientation.x = {1}", 510 } 511 SASINSTR_DET_OR_ROLL = {"variable" : "{0}.orientation.x = {1}", 617 512 "unit" : "orientation_unit", 618 513 "attributes" : SASINSTR_DET_OR_ATTR 619 } 620 SASINSTR_DET_OR_PITCH = { 621 "variable" : "{0}.orientation.y = {1}", 514 } 515 SASINSTR_DET_OR_PITCH = {"variable" : "{0}.orientation.y = {1}", 622 516 "unit" : "orientation_unit", 623 517 "attributes" : SASINSTR_DET_OR_ATTR 624 } 625 SASINSTR_DET_OR_YAW = { 626 "variable" : "{0}.orientation.z = {1}", 518 } 519 SASINSTR_DET_OR_YAW = {"variable" : "{0}.orientation.z = {1}", 627 520 "unit" : "orientation_unit", 628 521 "attributes" : SASINSTR_DET_OR_ATTR 629 } 630 SASINSTR_DET_OR = { 631 "variable" : None, 632 "children" : { 633 "roll" : SASINSTR_DET_OR_ROLL, 522 } 523 SASINSTR_DET_OR = {"variable" : None, 524 "children" : {"roll" : SASINSTR_DET_OR_ROLL, 634 525 "pitch" : SASINSTR_DET_OR_PITCH, 635 526 "yaw" : SASINSTR_DET_OR_YAW, 636 } 637 } 638 SASINSTR_DET_BC_X = { 639 "variable" : "{0}.beam_center.x = {1}", 527 } 528 } 529 SASINSTR_DET_BC_X = {"variable" : "{0}.beam_center.x = {1}", 640 530 "unit" : "beam_center_unit", 641 "attributes" : 642 { 643 "unit" : "{0}.beam_center_unit = \"{1}\"", 531 "attributes" : 532 {"unit" : "{0}.beam_center_unit = \"{1}\"", 644 533 "storeas" : "content" 534 } 535 } 536 SASINSTR_DET_BC_Y = {"variable" : "{0}.beam_center.y = {1}", 537 "unit" : "beam_center_unit", 538 "attributes" : 539 {"unit" : "{0}.beam_center_unit = \"{1}\"", 540 "storeas" : "content" 541 } 542 } 543 SASINSTR_DET_BC_Z = {"variable" : "{0}.beam_center.z = {1}", 544 "unit" : "beam_center_unit", 545 "attributes" : 546 {"unit" : "{0}.beam_center_unit = \"{1}\"", 547 "storeas" : "content" 548 } 549 } 550 SASINSTR_DET_BC = {"variable" : None, 551 "children" : {"x" : SASINSTR_DET_BC_X, 552 "y" : SASINSTR_DET_BC_Y, 553 "z" : SASINSTR_DET_BC_Z, 554 } 555 } 556 SASINSTR_DET_PIXEL_X = {"variable" : "{0}.pixel_size.x = {1}", 557 "unit" : "pixel_size_unit", 558 "attributes" : 559 {"unit" : "{0}.pixel_size_unit = \"{1}\"", 560 "storeas" : "content" 561 } 562 } 563 SASINSTR_DET_PIXEL_Y = {"variable" : "{0}.pixel_size.y = {1}", 564 "unit" : "pixel_size_unit", 565 "attributes" : 566 {"unit" : "{0}.pixel_size_unit = \"{1}\"", 567 "storeas" : "content" 568 } 569 } 570 SASINSTR_DET_PIXEL_Z = {"variable" : "{0}.pixel_size.z = {1}", 571 "unit" : "pixel_size_unit", 572 "attributes" : 573 {"unit" : "{0}.pixel_size_unit = \"{1}\"", 574 "storeas" : "content" 575 } 576 } 577 SASINSTR_DET_PIXEL = {"variable" : None, 578 "children" : {"x" : SASINSTR_DET_PIXEL_X, 579 "y" : SASINSTR_DET_PIXEL_Y, 580 "z" : SASINSTR_DET_PIXEL_Z, 581 } 582 } 583 SASINSTR_DET_SLIT = {"variable" : "{0}.slit_length = {1}", 584 "unit" : "slit_length_unit", 585 "attributes" : 586 {"unit" : 587 {"variable" : "{0}.slit_length_unit = \"{1}\"", 588 "storeas" : "content" 645 589 } 646 590 } 647 SASINSTR_DET_BC_Y = { 648 "variable" : "{0}.beam_center.y = {1}", 649 "unit" : "beam_center_unit", 650 "attributes" : 651 { 652 "unit" : "{0}.beam_center_unit = \"{1}\"", 653 "storeas" : "content" 654 } 655 } 656 SASINSTR_DET_BC_Z = { 657 "variable" : "{0}.beam_center.z = {1}", 658 "unit" : "beam_center_unit", 659 "attributes" : 660 { 661 "unit" : "{0}.beam_center_unit = \"{1}\"", 662 "storeas" : "content" 663 } 664 } 665 SASINSTR_DET_BC = { 666 "variable" : None, 667 "children" : { 668 "x" : SASINSTR_DET_BC_X, 669 "y" : SASINSTR_DET_BC_Y, 670 "z" : SASINSTR_DET_BC_Z, 591 } 592 SASINSTR_DET = {"storeas" : "float", 593 "variable" : None, 594 "attributes" : {"name" : 595 {"storeas" : "content", 596 "variable" : "{0}.name = \"{1}\"", 671 597 } 672 } 673 SASINSTR_DET_PIXEL_X = { 674 "variable" : "{0}.pixel_size.x = {1}", 675 "unit" : "pixel_size_unit", 676 "attributes" : 677 { 678 "unit" : "{0}.pixel_size_unit = \"{1}\"", 679 "storeas" : "content" 680 } 681 } 682 SASINSTR_DET_PIXEL_Y = { 683 "variable" : "{0}.pixel_size.y = {1}", 684 "unit" : "pixel_size_unit", 685 "attributes" : 686 { 687 "unit" : "{0}.pixel_size_unit = \"{1}\"", 688 "storeas" : "content" 689 } 690 } 691 SASINSTR_DET_PIXEL_Z = { 692 "variable" : "{0}.pixel_size.z = {1}", 693 "unit" : "pixel_size_unit", 694 "attributes" : 695 { 696 "unit" : "{0}.pixel_size_unit = \"{1}\"", 697 "storeas" : "content" 698 } 699 } 700 SASINSTR_DET_PIXEL = { 701 "variable" : None, 702 "children" : { 703 "x" : SASINSTR_DET_PIXEL_X, 704 "y" : SASINSTR_DET_PIXEL_Y, 705 "z" : SASINSTR_DET_PIXEL_Z, 706 } 707 } 708 SASINSTR_DET_SLIT = { 709 "variable" : "{0}.slit_length = {1}", 710 "unit" : "slit_length_unit", 711 "attributes" : 712 { 713 "unit" : 714 { 715 "variable" : "{0}.slit_length_unit = \"{1}\"", 716 "storeas" : "content" 717 } 718 } 719 } 720 SASINSTR_DET = { 721 "storeas" : "float", 722 "variable" : None, 723 "attributes" : { 724 "name" : 725 { 726 "storeas" : "content", 727 "variable" : "{0}.name = \"{1}\"", 728 } 729 }, 730 "children" : { 731 "name" : { 732 "storeas" : "content", 598 }, 599 "children" : {"name" : {"storeas" : "content", 733 600 "variable" : "{0}.name = \"{1}\"", 734 601 }, 735 602 "SDD" : SASINSTR_DET_SDD, 736 603 "offset" : SASINSTR_DET_OFF, … … 739 606 "pixel_size" : SASINSTR_DET_PIXEL, 740 607 "slit_length" : SASINSTR_DET_SLIT, 741 } 742 } 743 SASINSTR = { 744 "variable" : None, 745 "children" : 746 { 747 "variable" : None, 608 } 609 } 610 SASINSTR = {"variable" : None, 611 "children" : 612 {"variable" : None, 748 613 "name" : {"variable" : "{0}.instrument = \"{1}\""}, 749 614 "SASsource" : SASINSTR_SRC, 750 615 "SAScollimation" : SASINSTR_COLL, 751 616 "SASdetector" : SASINSTR_DET, 752 }, 753 } 754 CANSAS_FORMAT = { 755 "SASentry" : 756 { 757 "units_optional" : True, 617 }, 618 } 619 CANSAS_FORMAT = {"SASentry" : 620 {"units_optional" : True, 758 621 "variable" : None, 759 622 "storeas" : "content", 760 "attributes" : {"name" : {"variable" : \761 "{0}.run_name[node_value] = \"{1}\""}},762 "children" : {763 623 "attributes" : {"name" : 624 {"variable" : 625 "{0}.run_name[node_value] = \"{1}\""}}, 626 "children" : {"Title" : TITLE, 764 627 "Run" : RUN, 765 628 "SASdata" : SASDATA, … … 770 633 "SASnote" : SASNOTE, 771 634 "<any>" : ANY, 772 } 773 } 635 } 774 636 } 775 776 777 class CurrentLevel: 637 } 638 639 640 class CurrentLevel(object): 778 641 """ 779 642 A helper class to hold information on where you are in the constants tree 780 643 """ 781 644 782 645 current_level = '' 783 646 ns_variable = '' 784 647 ns_datatype = '' 785 648 ns_optional = True 786 649 787 650 def __init__(self): 788 651 self.current_level = {} … … 790 653 self.ns_datatype = "content" 791 654 self.ns_optional = True 792 655 793 656 def get_current_level(self): 794 657 """ … … 796 659 """ 797 660 return self.current_level 798 661 799 662 def get_data_type(self): 800 663 """ … … 802 665 """ 803 666 return self.ns_datatype 804 667 805 668 def get_variable(self): 806 669 """
Note: See TracChangeset
for help on using the changeset viewer.