Commits
Benjamin Bean authored aac52eeb7d5
67 67 | chan0 = chan_ids[0] |
68 68 | pol_ids = list( ret[field_id][chan0].keys() ) |
69 69 | if len(pol_ids) > 0: |
70 70 | pol0 = pol_ids[0] |
71 71 | nCycles = len( ret[field_id][chan0][pol0]['iterDone'] ) |
72 72 | |
73 73 | ret[field_id]['chans'] = chan_ids |
74 74 | ret[field_id]['pols'] = pol_ids |
75 75 | ret[field_id]['ncycs'] = nCycles |
76 76 | |
77 + | return ret |
78 + | |
77 79 | def _convertSingleFieldMatrix(single_field_matrix, calc_iterdone_deltas=None, keep_startvals=None): |
78 80 | summaryminor_dict = SummaryMinor.indexMinorCycleSummaryBySubimage(single_field_matrix) |
79 81 | percycleiters_dict = SummaryMinor._getPerCycleDict(copy.deepcopy(summaryminor_dict), calc_iterdone_deltas, keep_startvals) |
80 82 | return percycleiters_dict |
81 83 | |
82 84 | def _getFieldIds(matrix): |
83 85 | """ Get a sorted list of available outlier field ids in the given matrix """ |
84 86 | availRows = SummaryMinor.getRowDescriptionsOldOrder() |
85 87 | if not "multifieldId" in availRows: |
86 88 | return [0] |
87 89 | multifieldIdx = availRows.index("multifieldId") |
88 90 | nrows = matrix.shape[0] |
89 91 | ncols = matrix.shape[1] |
90 92 | fieldIds = sorted(np.unique(matrix[multifieldIdx,:]).tolist()) |
93 + | fieldIds = list(map(lambda x: int(x), fieldIds)) |
91 94 | return fieldIds |
92 95 | |
93 96 | def _getSingleFieldMatrix(matrixIn, fieldId): |
94 97 | """ Create a new matrix to hold all the values of the given matrix, but only for the given outlier field id """ |
95 98 | availRows = SummaryMinor.getRowDescriptionsOldOrder() |
96 99 | if not "multifieldId" in availRows: |
97 100 | return matrixIn |
98 101 | multifieldIdx = availRows.index("multifieldId") |
99 102 | nrowsIn = matrixIn.shape[0] |
100 103 | ncolsIn = matrixIn.shape[1] |
152 155 | availRows = SummaryMinor._getRowDescriptionsOldOrder(useSmallSummaryminor) |
153 156 | ret = list(filter(lambda x: x in availRows, ret)) |
154 157 | return ret |
155 158 | |
156 159 | def getRowStartDescs(): |
157 160 | """ Retrieves abreviated names of the available minor cycle summary "start" rows. |
158 161 | |
159 162 | These are the rows that catalog the values at the beggining of a minor cycle (pre-deconvolution). """ |
160 163 | return SummaryMinor._getRowStartDescs(SummaryMinor.useSmallSummaryminor()) |
161 164 | |
162 - | def indexMinorCycleSummaryBySubimage(self, matrix): |
165 + | def indexMinorCycleSummaryBySubimage(matrix): |
163 166 | """ Re-indexes matrix from [row,column] to [channel,polarity,row,cycle]. |
164 167 | |
165 168 | Param matrix: the original matrix to convert. |
166 169 | """ |
167 170 | # get some properties of the summary_minor matrix |
168 171 | nrows = matrix.shape[0] |
169 172 | ncols = matrix.shape[1] |
170 173 | import sys |
171 174 | oldChanIdx = SummaryMinor.getRowDescriptionsOldOrder().index("chan") |
172 175 | newChanIdx = SummaryMinor.getRowDescriptions().index("chan") |