@@ -399,7 +399,70 class ParamReader(ProcessingUnit): | |||||
399 | self.listData = listdata |
|
399 | self.listData = listdata | |
400 | return |
|
400 | return | |
401 |
|
401 | |||
|
402 | def __setDataArray(self, dataset, shapes): | |||
|
403 | ||||
|
404 | nDims = shapes[0] | |||
|
405 | ||||
|
406 | nDim2 = shapes[1] #Dimension 0 | |||
402 |
|
407 | |||
|
408 | nDim1 = shapes[2] #Dimension 1, number of Points or Parameters | |||
|
409 | ||||
|
410 | nDim0 = shapes[3] #Dimension 2, number of samples or ranges | |||
|
411 | ||||
|
412 | mode = shapes[4] #Mode of storing | |||
|
413 | ||||
|
414 | blockList = self.blockList | |||
|
415 | ||||
|
416 | blocksPerFile = self.blocksPerFile | |||
|
417 | ||||
|
418 | #Depending on what mode the data was stored | |||
|
419 | if mode == 0: #Divided in channels | |||
|
420 | arrayData = dataset.value.astype(numpy.float)[0][blockList] | |||
|
421 | if mode == 1: #Divided in parameter | |||
|
422 | strds = 'table' | |||
|
423 | nDatas = nDim1 | |||
|
424 | newShapes = (blocksPerFile,nDim2,nDim0) | |||
|
425 | elif mode==2: #Concatenated in a table | |||
|
426 | strds = 'table0' | |||
|
427 | arrayData = dataset[strds].value | |||
|
428 | #Selecting part of the dataset | |||
|
429 | utctime = arrayData[:,0] | |||
|
430 | u, indices = numpy.unique(utctime, return_index=True) | |||
|
431 | ||||
|
432 | if blockList.size != indices.size: | |||
|
433 | indMin = indices[blockList[0]] | |||
|
434 | if blockList[1] + 1 >= indices.size: | |||
|
435 | arrayData = arrayData[indMin:,:] | |||
|
436 | else: | |||
|
437 | indMax = indices[blockList[1] + 1] | |||
|
438 | arrayData = arrayData[indMin:indMax,:] | |||
|
439 | return arrayData | |||
|
440 | ||||
|
441 | # One dimension | |||
|
442 | if nDims == 0: | |||
|
443 | arrayData = dataset.value.astype(numpy.float)[0][blockList] | |||
|
444 | ||||
|
445 | # Two dimensions | |||
|
446 | elif nDims == 2: | |||
|
447 | arrayData = numpy.zeros((blocksPerFile,nDim1,nDim0)) | |||
|
448 | newShapes = (blocksPerFile,nDim0) | |||
|
449 | nDatas = nDim1 | |||
|
450 | ||||
|
451 | for i in range(nDatas): | |||
|
452 | data = dataset[strds + str(i)].value | |||
|
453 | arrayData[:,i,:] = data[blockList,:] | |||
|
454 | ||||
|
455 | # Three dimensions | |||
|
456 | else: | |||
|
457 | arrayData = numpy.zeros((blocksPerFile,nDim2,nDim1,nDim0)) | |||
|
458 | for i in range(nDatas): | |||
|
459 | ||||
|
460 | data = dataset[strds + str(i)].value | |||
|
461 | ||||
|
462 | for b in range(blockList.size): | |||
|
463 | arrayData[b,:,i,:] = data[:,:,blockList[b]] | |||
|
464 | ||||
|
465 | return arrayData | |||
403 |
|
466 | |||
404 | def __setDataOut(self): |
|
467 | def __setDataOut(self): | |
405 | listMeta = self.listMeta |
|
468 | listMeta = self.listMeta |
General Comments 0
You need to be logged in to leave comments.
Login now