MCPcopy
hub / github.com/WassimTenachi/PhySO / set_non_positional_from_idx

Method set_non_positional_from_idx

physo/physym/vect_programs.py:1253–1281  ·  view source on GitHub ↗

Sets non_positional properties and index of new tokens as given in the library. Parameters ---------- coords_dest : numpy.array of shape (2, ?) of int Coords where to set new tokens, 0th array in batch dim and 1th array in time dim. tokens_idx_src

(self, coords_dest, tokens_idx_src)

Source from the content-addressed store, hash-verified

1251 return None
1252
1253 def set_non_positional_from_idx (self, coords_dest, tokens_idx_src):
1254 """
1255 Sets non_positional properties and index of new tokens as given in the library.
1256 Parameters
1257 ----------
1258 coords_dest : numpy.array of shape (2, ?) of int
1259 Coords where to set new tokens, 0th array in batch dim and 1th array in time dim.
1260 tokens_idx_src : numpy.array of shape (batch_size,)
1261 Index of new tokens.
1262 """
1263 # ------------------------ non_positional ------------------------
1264 # Index
1265 self.tokens.idx [coords_dest[0], coords_dest[1]] = tokens_idx_src
1266 # ------------------------ non_positional ------------------------
1267 # ---- Token representation
1268 # ( name : str (<MAX_NAME_SIZE) )
1269 # ( sympy_repr : str (<MAX_NAME_SIZE) )
1270 # ---- Token main properties
1271 self.tokens.arity [coords_dest[0], coords_dest[1]] = self.lib("arity") [tokens_idx_src]
1272 self.tokens.complexity [coords_dest[0], coords_dest[1]] = self.lib("complexity") [tokens_idx_src]
1273 self.tokens.var_type [coords_dest[0], coords_dest[1]] = self.lib("var_type") [tokens_idx_src]
1274 self.tokens.var_id [coords_dest[0], coords_dest[1]] = self.lib("var_id") [tokens_idx_src]
1275 # ( function : callable or None )
1276 # ---- Physical units : behavior id
1277 self.tokens.behavior_id [coords_dest[0], coords_dest[1]] = self.lib("behavior_id") [tokens_idx_src]
1278 # ---- Physical units : power
1279 self.tokens.is_power [coords_dest[0], coords_dest[1]] = self.lib("is_power") [tokens_idx_src]
1280 self.tokens.power [coords_dest[0], coords_dest[1]] = self.lib("power") [tokens_idx_src]
1281 return None
1282
1283 # -------- MISCELLANEOUS--------
1284

Callers 3

__init__Method · 0.95
appendMethod · 0.95
fill_with_voidMethod · 0.95

Calls 1

libMethod · 0.95

Tested by

no test coverage detected