xpressinsight.AppInterface.capture
Purpose
Sets the list of entities to be saved back to the Insight scenario at the end of the current execution mode.
Synopsis
xpressinsight.AppInterface.capture(self, entities: Iterable[str] | Iterable[EntityBase] = None, *, entity_filter: Callable[[Entity], bool] = None) -> None
Arguments
|
entities
|
The entities to be captured. May be specified as a list of entity names or entity objects. If names are specified, columns can be identified using the pattern "<frame_name>.<col_name>" or by using their entity names (by default
"<frame_name>_<col_name>"). If a DataFrame is specified, then we will capture all columns in the frame declared with either
manage=RESULT or
update_after_execution=True.
|
|
entity_filter
|
If specified, the given function will be called for each
Entity and that entity will be captured if the function returned
True.
|
Return value
This function may raise the following errors:
Example
Demonstration of configuring entities to capture
>>> import xpressinsight as xi
...
... @xi.AppConfig("My App")
... class InsightApp(xi.AppBase):
... profit: xi.types.Scalar(dtype=xi.real, manage=xi.Manage.RESULT)
... factories: xi.types.Index(dtype=xi.string, update_after_execution=True)
... factory_names: xi.types.Series(dtype=xi.string, index='factories',
... update_after_execution=True)
... factories_frame: xi.types.DataFrame(index='factories', columns=[
... xi.types.Column('Capacity', dtype=xi.real,
... update_after_execution=True),
... xi.types.Column('Cost', dtype=xi.real,
... update_after_execution=True)]
...
... @xi.ExecMode(name='demo1')
... def demo1(self):
... # Configure scenario to capture only 'profit' scalar and all columns
... # in 'factories_frame'
... self.insight.capture(['profit', 'factories_frame'])
... # Solve the model
... self.solvemodel1()
...
... @xi.ExecMode(name='demo2')
... def demo2(self):
... # Configure scenario to capture all entities whose name starts
... # with 'factor' - 'factories', 'factory_name' and all columns
... # in 'factories_frame'
... self.insight.capture(
... entity_filter=lambda e: e.entity_name.startswith('factor'))
... # Solve the model
... self.solvemodel2()
Further information
2. It's recommended to call this as early in the execution mode as possible, so that other entities aren't unexpectedly captured in event of an error - the values won't be captured until the end of the execution mode regardless of where the
capture function is called.
3. If this function is not called, then the values of all result and updateable input entities will be captured at the end of the execution mode.
4. This function cannot be called from an execution mode with
clear_input=True; in these execution modes, all input entities will be captured and this behavior cannot be changed.
5. When specifying an indexed entity (e.g. a
Series or
DataFrame), the index entities will automatically be captured as well.
Related topics
© 2001-2026 Fair Isaac Corporation. All rights reserved. This documentation is the property of Fair Isaac Corporation ("FICO"). Receipt or possession of this documentation does not convey rights to disclose, reproduce, make derivative works, use, or allow others to use it except solely for internal evaluation purposes to determine whether to purchase a license to the software described in this documentation, or as otherwise set forth in a written software license agreement between you and FICO (or a FICO affiliate). Use of this documentation and the software described in it must conform strictly to the foregoing permitted uses, and no other use is permitted.
