Flip 2D or 3D array. The flip happens on the second index of shape. .. warning :: This function mutates the input values. Parameters ---------- input_data : 2D or 3D array. Returns ------- flipped data
(input_data, subscan_dims=None)
| 102 | |
| 103 | |
| 104 | def flip_data(input_data, subscan_dims=None): |
| 105 | """ |
| 106 | Flip 2D or 3D array. The flip happens on the second index of shape. |
| 107 | .. warning :: This function mutates the input values. |
| 108 | |
| 109 | Parameters |
| 110 | ---------- |
| 111 | input_data : 2D or 3D array. |
| 112 | |
| 113 | Returns |
| 114 | ------- |
| 115 | flipped data |
| 116 | """ |
| 117 | new_data = np.asarray(input_data) |
| 118 | data_shape = input_data.shape |
| 119 | if len(data_shape) == 2: |
| 120 | if subscan_dims is None: |
| 121 | new_data[1::2, :] = new_data[1::2, ::-1] |
| 122 | else: |
| 123 | i = 0 |
| 124 | for nx, ny in subscan_dims: |
| 125 | start = i + 1 |
| 126 | end = i + ny |
| 127 | new_data[start:end:2, :] = new_data[start:end:2, ::-1] |
| 128 | i += ny |
| 129 | |
| 130 | if len(data_shape) == 3: |
| 131 | if subscan_dims is None: |
| 132 | new_data[1::2, :, :] = new_data[1::2, ::-1, :] |
| 133 | else: |
| 134 | i = 0 |
| 135 | for nx, ny in subscan_dims: |
| 136 | start = i + 1 |
| 137 | end = i + ny |
| 138 | new_data[start:end:2, :, :] = new_data[start:end:2, ::-1, :] |
| 139 | i += ny |
| 140 | return new_data |
| 141 | |
| 142 | |
| 143 | def fetch_run_info(run_id_uid, catalog_name=None): |
no outgoing calls
no test coverage detected