Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 0 additions & 29 deletions docs/source/workflows/data_sources.rst
Original file line number Diff line number Diff line change
Expand Up @@ -48,32 +48,3 @@ The example below assumes that the uuid and the version of the desired GEM Table
Note that the descriptor keys above are the headers of the *variable* not the column in the table.
The last term in the column header is a suffix associated with the specific column definition rather than the variable.
It should be omitted from the descriptor key.

Experiment Data Source
----------------------

An :class:`~citrine.resources.experiment_datasource.ExperimentDataSource` references a snapshot of the Experiment Results in a Branch that are fit for training.
This snapshot is created when one updates the data on a Branch and chooses to include Experiment Results in the training data via the web application.
There is only one Experiment Data Source per Branch, though it is versioned.
The version increments everytime a new or updated Experiment Result is chosen as training data via the web application.

One can reference an Experiment Data Source from a branch:

.. code:: python

eds = branch.experiment_datasource

The `.read()` method will return a string in a CSV-friendly format for convenient export or further analysis:

.. code:: python

# Write to CSV:
with open('experiment_datasource.csv', 'w') as f:
f.write(eds.read())

# Convert to a Pandas DataFrame
import pandas as pd
from io import StringIO

eds_io = StringIO(eds.read())
eds_dataframe = pd.read_csv(eds_io.read()))
2 changes: 1 addition & 1 deletion src/citrine/__version__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "4.3.0"
__version__ = "5.0.0"
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class IngredientRatioConstraint(Serializable['IngredientRatioConstraint'], Const
# The backend provides basis ingredients and basis labels as a dictionary from the key to a
# multiplier. However, for ingredient ratio constraints, the multiplier in the denominator
# should always be one, so we can't allow users to enter it. We need to use properties for this
# behavior. It also allows us to display deprecation warnings for the coming type change.
# behavior.
_basis_ingredients = properties.Mapping(
properties.String, properties.Float, 'basis_ingredients', default={})
_basis_labels = properties.Mapping(
Expand Down
36 changes: 1 addition & 35 deletions src/citrine/informatics/data_sources.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
from abc import abstractmethod
from uuid import UUID

from deprecation import deprecated

from citrine._serialization import properties
from citrine._serialization.polymorphic_serializable import PolymorphicSerializable
from citrine._serialization.serializable import Serializable
Expand All @@ -12,7 +10,6 @@
__all__ = [
'DataSource',
'GemTableDataSource',
'ExperimentDataSourceRef',
'SnapshotDataSource',
]

Expand All @@ -33,7 +30,7 @@ def __eq__(self, other):

@classmethod
def _subclass_list(self) -> list[type[Serializable]]:
return [GemTableDataSource, ExperimentDataSourceRef, SnapshotDataSource]
return [GemTableDataSource, SnapshotDataSource]

@classmethod
def get_type(cls, data) -> type[Serializable]:
Expand Down Expand Up @@ -116,37 +113,6 @@ def from_gemtable(cls, table: GemTable) -> "GemTableDataSource":
return GemTableDataSource(table_id=table.uid, table_version=table.version)


class ExperimentDataSourceRef(Serializable['ExperimentDataSourceRef'], DataSource):
"""[DEPRECATED] A reference to a data source based on an experiment result on the platform.

Parameters
----------
datasource_id: UUID
Unique identifier for the Experiment Data Source

"""

typ = properties.String('type', default='experiments_data_source', deserializable=False)
datasource_id = properties.UUID("datasource_id")

_data_source_type = "experiments"

@deprecated(deprecated_in="4.1.0", removed_in="5.0.0",
details="Replaced by creating materials from candidates on the platform. "
"Alternatively, you may convert the candidate into a collection of GEMD "
"objects manually.")
def __init__(self, *, datasource_id: UUID):
self.datasource_id: UUID = datasource_id

@classmethod
def _data_source_id_builder(cls, *args) -> DataSource:
return ExperimentDataSourceRef(datasource_id=UUID(args[0]))

def to_data_source_id(self) -> str:
"""Generate the data_source_id for this DataSource."""
return f"{self._data_source_type}::{self.datasource_id}"


class SnapshotDataSource(Serializable['SnapshotDataSource'], DataSource):
"""A reference to a data source based on a Snapshot on the data platform.

Expand Down
149 changes: 0 additions & 149 deletions src/citrine/informatics/experiment_values.py

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from deprecation import deprecated

from citrine._rest.resource import Resource
from citrine._serialization import properties
from citrine.informatics.descriptors import ChemicalFormulaDescriptor
Expand Down Expand Up @@ -152,11 +150,5 @@ def __init__(self,
self.excludes = excludes if excludes is not None else []
self.powers = powers if powers is not None else [1.0]

@property
@deprecated(deprecated_in="4.0.0", removed_in="5.0.0", details="Use 'powers' instead.")
def powers_as_float(self) -> list[float]:
"""Powers when computing generalized weighted means of element properties."""
return self.powers

def __str__(self):
return '<ChemicalFormulaFeaturizer {!r}>'.format(self.name)
11 changes: 0 additions & 11 deletions src/citrine/resources/branch.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
from citrine.exceptions import NotFound
from citrine.resources.data_version_update import BranchDataUpdate, NextBranchVersionRequest
from citrine.resources.design_workflow import DesignWorkflowCollection
from citrine.resources.experiment_datasource import (ExperimentDataSourceCollection,
ExperimentDataSource)


LATEST_VER = "latest" # Refers to the most recently created branch version.
Expand Down Expand Up @@ -56,15 +54,6 @@ def design_workflows(self) -> DesignWorkflowCollection:
branch_root_id=self.root_id,
branch_version=self.version)

@property
def experiment_datasource(self) -> ExperimentDataSource | None:
"""Return this branch's experiment data source, or None if one doesn't exist."""
if getattr(self, 'project_id', None) is None:
raise AttributeError('Cannot retrieve datasource without project reference!')
erds = ExperimentDataSourceCollection(project_id=self.project_id, session=self.session)
branch_erds_iter = erds.list(branch_version_id=self.uid, version=LATEST_VER)
return next(branch_erds_iter, None)

def _post_dump(self, data: dict) -> dict:
# Only the data portion of an entity is sent to the server.
data = data["data"]
Expand Down
Loading
Loading