def update_externally_derivable_components(self, data=None): """ Update all the externally derived components in all data objects, based on all the Components deriveable based on the links in self. This overrides any ComponentLinks stored in the DerivedComponents of the data itself -- any components which depend on a link not tracked by the LinkManager will be deleted. Parameters ----------- data : Data object Behavior -------- DerivedComponents will be replaced / added into the data object """ if self.data_collection is None: if data is None: return else: data_collection = [data] else: data_collection = self.data_collection for data in data_collection: links = discover_links(data, self._links | self._inverse_links) comps = {} for cid, link in six.iteritems(links): d = DerivedComponent(data, link) comps[cid] = d data._set_externally_derivable_components(comps)
def _add_deriveable_components(self, data): """Find and add any DerivedComponents that a data object can calculate given the ComponentLinks tracked by this LinkManager """ links = discover_links(data, self._links) for cid, link in six.iteritems(links): d = DerivedComponent(data, link) data.add_component(d, cid)
def _add_deriveable_components(self, data): """Find and add any DerivedComponents that a data object can calculate given the ComponentLinks tracked by this LinkManager """ links = discover_links(data, self._links | self._inverse_links) for cid, link in six.iteritems(links): d = DerivedComponent(data, link) if cid not in data.components: # Need to hide component since we don't want to show components # that are auto-generated in datasets by default. cid.hidden = True data.add_component(d, cid)
def update_externally_derivable_components(self, data=None): """ Update all the externally derived components in all data objects, based on all the Components deriveable based on the links in self. This overrides any ComponentLinks stored in the DerivedComponents of the data itself -- any components which depend on a link not tracked by the LinkManager will be deleted. Parameters ----------- data : Data object Behavior -------- DerivedComponents will be replaced / added into the data object """ if self.data_collection is None: if data is None: return else: data_collection = [data] else: data_collection = self.data_collection # Only keep actual Data instances since only they support links for now data_collection = [d for d in data_collection if isinstance(d, Data)] for data in data_collection: links = discover_links(data, self._links | self._inverse_links) comps = {} for cid, link in six.iteritems(links): d = DerivedComponent(data, link) comps[cid] = d data._set_externally_derivable_components(comps) # Now update information about pixel-aligned data for data1 in data_collection: equivalent = {} for data2 in data_collection: if data1 is not data2: order = equivalent_pixel_cids(data2, data1) if order is not None: equivalent[data2] = order data1._set_pixel_aligned_data(equivalent)