Registers tokens located at coords_dest in their own ancestor records (as a token counts as its own ancestor) and updates the number of ancestors. Depths must be up-to-date for this function to perform correctly. Parameters ---------- coords_dest : numpy.arra
(self, coords_dest, )
| 1182 | self.tokens.n_ancestors [coords_dest[0], coords_dest[1]] = nb # (?,) of int |
| 1183 | |
| 1184 | def register_ancestor(self, coords_dest, ): |
| 1185 | """ |
| 1186 | Registers tokens located at coords_dest in their own ancestor records (as a token counts as its own ancestor) |
| 1187 | and updates the number of ancestors. Depths must be up-to-date for this function to perform correctly. |
| 1188 | Parameters |
| 1189 | ---------- |
| 1190 | coords_dest : numpy.array of shape (2, ?) of int |
| 1191 | Coords of tokens which's ancestors records should be updated, 0th array in batch dim and 1th array in time dim. |
| 1192 | """ |
| 1193 | # ? = number of tokens which need their ancestor to be updated |
| 1194 | n_tokens = coords_dest.shape[1] |
| 1195 | |
| 1196 | # Records of ancestors positions for token at coords_dest (ie vectors of size ? of family lines) |
| 1197 | records_ancestors_pos = self.tokens.ancestors_pos[tuple(coords_dest)] # (?, max_time_step) of int |
| 1198 | |
| 1199 | # Coords of locations in records_ancestors_pos where the new ancestors should be placed. Since we are |
| 1200 | # registering token as their own ancestors, this is performed at their own depth in the family line. |
| 1201 | coords_new_ancestors = np.stack(( # (2, ?,) of int |
| 1202 | np.arange(n_tokens), |
| 1203 | # token dim coord (always = [1,2,3..] because records_ancestors_pos is already the subset of interest) |
| 1204 | self.tokens.depth[tuple(coords_dest)], # ancestor line dim coord ie own depth of tokens to affect |
| 1205 | ), axis=0) |
| 1206 | |
| 1207 | # Registering tokens as their own ancestors ie. adding own token positions (time dim) in their records |
| 1208 | records_ancestors_pos[tuple(coords_new_ancestors)] = coords_dest[1] |
| 1209 | self.tokens.ancestors_pos[tuple(coords_dest)] = records_ancestors_pos |
| 1210 | |
| 1211 | # Update number of ancestors |
| 1212 | self.tokens.n_ancestors[tuple(coords_dest)] = self.tokens.depth[tuple(coords_dest)] + 1 |
| 1213 | |
| 1214 | # Update number of ancestors |
| 1215 | self.tokens.has_ancestors_mask[tuple(coords_dest)] = True |
| 1216 | |
| 1217 | return None |
| 1218 | |
| 1219 | def set_units (self, coords_dest, new_is_constraining_phy_units, new_phy_units): |
| 1220 | """ |
no outgoing calls
no test coverage detected