(cls, array)
| 111 | |
| 112 | @classmethod |
| 113 | def from_array(cls, array): |
| 114 | n_bpts, n_cols = array.shape |
| 115 | |
| 116 | # if a single coordinate is NaN for a bodypart, set all to NaN |
| 117 | array[np.isnan(array).any(axis=-1)] = np.nan |
| 118 | |
| 119 | ass = cls(size=n_bpts) |
| 120 | ass.data[:, :n_cols] = array |
| 121 | visible = np.flatnonzero(~np.isnan(array).any(axis=1)) |
| 122 | if n_cols < 3: # Only xy coordinates are being set |
| 123 | ass.data[visible, 2] = 1 # Set detection confidence to 1 |
| 124 | ass._visible.update(visible) |
| 125 | return ass |
| 126 | |
| 127 | @property |
| 128 | def xy(self): |
no test coverage detected