InvestigatorConnection#

class cegalprizm.investigator.InvestigatorConnection(use_licensed_features: bool = False, hub_context: Optional[cegalprizm.hub.base_ctx.BaseContext] = None, hub_connection_parameters: Optional[cegalprizm.hub.connection_parameters.ConnectionParameters] = None)#

This class represents a connection to an instance of Investigator

The connection to Investigator will be made using Hub. It may be either:

  • local (on the same machine running Python)

  • remote (on a machine on the same network)

  • cloud (on a machine connected via the cloud)

The Investigator may be running as:

  • A plugin inside Petrel

  • A standalone investigator server

Functions

__init__([use_licensed_features, ...])

available_investigations()

Returns a list of the available investigations

create_iris_investigation()

Creates a investigation containing the iris dataset

investigation_from_dataframe(dataframe[, ...])

Creates an investigation from the specified dataframe

investigation_from_file(path)

Creates an investigation from the specified file

load_investigation([name, investigation_id])

Loads the investigation via Hub

remove_investigation([name, investigation_id])

This removes an investigation from the Investigator server

renew_context()

This will force the Hub connection to be reset

set_connector_labels(labels)

Set specific connector labels to be used

available_investigations() List[cegalprizm.investigator.named_tuples.InvestigationInfoTuple]#

Returns a list of the available investigations

Raises

CegalHubError – if an unexpected error is reported by Hub

Returns

A list of tuples containing the id and name for each available investigation

Return type

List[InvestigationInfoTuple]

create_iris_investigation() cegalprizm.investigator.inv.investigation.Investigation#

Creates a investigation containing the iris dataset

THe iris dataset is well know in data science and often used for examples.

Raises

CegalHubError – if an unexpected error is reported by Hub

Returns

An object representing the Iris investigation

Return type

Investigation

investigation_from_dataframe(dataframe: pandas.core.frame.DataFrame, continuous_column_names: Optional[Sequence[str]] = None, continuous_column_info: Optional[Dict[str, cegalprizm.investigator.named_tuples.ContinuousDimensionInfoTuple]] = None, discrete_column_names: Optional[Sequence[str]] = None, dataset_column_name: Optional[str] = None, sample_index_column_names: Optional[Sequence[str]] = None) cegalprizm.investigator.inv.investigation.Investigation#

Creates an investigation from the specified dataframe

If none of the optional parameters as provided, then the “best” guess of how to represent the dataframe as an investigation will be used.

Parameters
  • dataframe (pd.DataFrame) – The input dataframe

  • continuous_column_names (Sequence[str], optional) – a list of the dataframe column names to include in the investigation as continuous dimensions. Defaults to None.

  • continuous_column_info (Dict[str, ContinuousDimensionInfoTuple], optional) – a dictionary containing the ContinuousDimensionInfoTuple for each continuous dimension in the investigation. Defaults to None.

  • discrete_column_names (Sequence[str], optional) – a list of the dataframe column names to include in the investigation as discrete dimensions. Defaults to None.

  • dataset_column_name (str, optional) – a dataframe column name which should be used to identify different datasets. Defaults to None.

  • sample_index_column_names (Sequence[str], optional) – a list of the dataframe column names that identify sample index columns. The sample indices will be evaluated in the order of this list. Defaults to None.

Raises

CegalHubError – if an unexpected error is reported by Hub

Returns

An object representing the investigation

Return type

Investigation

investigation_from_file(path: str) cegalprizm.investigator.inv.investigation.Investigation#

Creates an investigation from the specified file

Parameters

path (str) – The path to the invpy file

Raises

CegalHubError – if an unexpected error is reported by Hub

Returns

An object representing the investigation

Return type

Investigation

load_investigation(name: Optional[str] = None, investigation_id: Optional[str] = None) cegalprizm.investigator.inv.investigation.Investigation#

Loads the investigation via Hub

Note: Either the name or the investigation_id must be defined.

Parameters
  • name (str, optional) – The name of the investigation to be loaded. Defaults to None.

  • investigation_id (str, optional) – The id of the investigation to be loaded. Defaults to None.

Raises
  • CegalHubError – if an unexpected error is reported by Hub

  • ValueError – if the supplied parameters are both missing or if it is invalid

Returns

An object representing the investigation

Return type

Investigation

remove_investigation(name: Optional[str] = None, investigation_id: Optional[str] = None)#

This removes an investigation from the Investigator server

Removing the investigation will mean its data it can no longer be accessed and it will not be possible to create plots based on the investigation.

Note: Either the name or the investigation_id must be defined. Note: Removal of an investigation is immediate and cannot be reversed.

Parameters
  • name (str, optional) – The name of the investigation to be removed. Defaults to None.

  • investigation_id (str, optional) – The id of the investigation to be removed. Defaults to None.

Raises
  • CegalHubError – if an unexpected error is reported by Hub

  • ValueError – if the supplied parameters are both missing or if it is invalid

renew_context()#

This will force the Hub connection to be reset

This should only be necessary if Hub is restarted or a new instance of Petrel is attached.

set_connector_labels(labels: Dict[str, str])#

Set specific connector labels to be used

The supplied connector labels will be used as a filter to select the connector to be used for communication with Investigator. For example, labels can be used to target a specific Petrel instance when more than 1 instance available.

Parameters

labels (Dict[str, str]) – A dictionary of key-value strings labels