study
Classes:
-
Study–Represents an Antares study.
Functions:
-
create_study_api–Creates a study on antares-web server.
-
create_study_local–Creates a new study on your filesystem.
-
create_variant_api–Creates a new variant of an existing study, on antares-web server.
-
import_study_api–Creates a study on antares-web server, by importing an existing study archive from your filesystem.
-
read_outputs_api–Reads all outputs for a given study from antares-web server.
-
read_outputs_local–Reads all outputs of an existing study on your filesystem.
-
read_study_api–Reads an existing study from antares-web server.
-
read_study_local–Reads an existing study on your filesystem.
Study
Represents an Antares study.
This interface allows inspection and editing of study data, including study settings, areas, thermal clusters, hydro modeling, short-term storages, and generic binding constraints.
It also allows launching Antares simulations.
A study should not be created through its constructor. Please use one of the factory methods instead:
Methods:
-
create_area–Adds a new area to the study.
-
create_binding_constraint–Create a new binding constraint.
-
create_link–Adds a new link to the study.
-
create_variant–Creates a new variant for the study
-
create_xpansion_configuration–Create an xpansion configuration.
-
delete–Deletes this study.
-
delete_area–Deletes the specified area.
-
delete_binding_constraints–Deletes the specified binding constraint.
-
delete_link–Deletes the specified link.
-
delete_output–Deletes the specified output.
-
delete_outputs–Deletes all simulation outputs.
-
delete_xpansion_configuration–Delete current xpansion configuration.
-
generate_thermal_timeseries–Generates timeseries for thermal clusters availability, based on timeseries generation parameters.
-
get_areas–Retrieve a dictionary of the study areas.
-
get_binding_constraints–Retrieve a dictionary of the binding constraints.
-
get_links–Retrieve a dictionary of the study links.
-
get_output–Get a specific output
-
get_outputs–Get outputs of current study.
-
get_scenario_builder–Get scenario builder.
-
get_settings–Retrieve the study settings.
-
move–Moves the study to another directory.
-
run_antares_simulation–Runs the Antares simulation.
-
set_playlist–Set the playlist to give relative weights to each Monte Carlo year.
-
set_scenario_builder–Set scenario builder.
-
set_thematic_trimming–Set a thematic trimming to select the outputs of the simulation.
-
update_areas–Update existing areas properties.
-
update_binding_constraints–Update existing binding constraints.
-
update_links–Update existing links.
-
update_renewable_clusters–Update existing renewable cluster properties.
-
update_settings–Updates the study settings.
-
update_st_storages–Update existing short-term storage.
-
update_st_storages_constraints–Update existing short-term storage constraints.
-
update_thermal_clusters–Update existing thermal cluster properties.
-
wait_job_completion–Waits for the completion of a job.
Attributes:
-
has_an_xpansion_configuration(bool) –Whether there is an xpansion configuration.
-
xpansion(XpansionConfiguration) –Xpansion configuration.
Source code in src/antares/craft/model/study.py
has_an_xpansion_configuration
property
has_an_xpansion_configuration: bool
Whether there is an xpansion configuration.
create_area
create_area(
area_name: str,
*,
properties: Optional[AreaProperties] = None,
ui: Optional[AreaUi] = None,
) -> Area
Adds a new area to the study.
Parameters:
-
(area_namestr) –The name of the new area
-
(propertiesOptional[AreaProperties], default:None) –Optional values for the properties of the area. If none are provided, the default values are used.
-
(uiOptional[AreaUi], default:None) –Optional values for the UI properties of the area. If none are provided, the default values are used.
Returns:
-
Area–The newly created area.
Source code in src/antares/craft/model/study.py
create_binding_constraint
create_binding_constraint(
*,
name: str,
properties: Optional[BindingConstraintProperties] = None,
terms: Optional[List[ConstraintTerm]] = None,
less_term_matrix: Optional[DataFrame] = None,
equal_term_matrix: Optional[DataFrame] = None,
greater_term_matrix: Optional[DataFrame] = None,
) -> BindingConstraint
Create a new binding constraint.
Parameters:
-
(namestr) –The name of the binding constraint.
-
(propertiesOptional[BindingConstraintProperties], default:None) –Optional properties for the constraint.
-
(termsOptional[List[ConstraintTerm]], default:None) –Optional list of terms for the constraint.
-
(less_term_matrixOptional[DataFrame], default:None) –Optional less-than term matrix.
-
(equal_term_matrixOptional[DataFrame], default:None) –Optional equality term matrix.
-
(greater_term_matrixOptional[DataFrame], default:None) –Optional greater-than term matrix.
Returns:
-
BindingConstraint–The newly created binding constraint.
Source code in src/antares/craft/model/study.py
create_link
create_link(
*,
area_from: str,
area_to: str,
properties: Optional[LinkProperties] = None,
ui: Optional[LinkUi] = None,
) -> Link
Adds a new link to the study.
Parameters:
-
(area_fromstr) –The id of the area from which the link starts
-
(area_tostr) –The id of the area to which the link connects
-
(propertiesOptional[LinkProperties], default:None) –Optional values for the properties of the link. If none are provided, the default values are used.
-
(uiOptional[LinkUi], default:None) –Optional values for the UI properties of the link. If none are provided, the default values are used.
Returns:
-
Link–The newly created link.
Source code in src/antares/craft/model/study.py
create_variant
create_variant(variant_name: str) -> Study
create_xpansion_configuration
create_xpansion_configuration() -> XpansionConfiguration
Create an xpansion configuration.
Returns:
-
XpansionConfiguration–Default xpansion configuration.
Source code in src/antares/craft/model/study.py
delete
Deletes this study.
Parameters:
-
(childrenbool, default:False) –If True, also delete all children studies. That parameter only makes sense for variant studies on antares-web.
Source code in src/antares/craft/model/study.py
delete_area
Deletes the specified area.
Parameters:
-
(areaArea) –Name of the area.
Source code in src/antares/craft/model/study.py
delete_binding_constraints
delete_binding_constraints(constraints: list[BindingConstraint]) -> None
Deletes the specified binding constraint.
Parameters:
-
(constraintslist[BindingConstraint]) –A list of binding constraints to delete.
Source code in src/antares/craft/model/study.py
delete_link
Deletes the specified link.
Parameters:
-
(linkLink) –The link object to delete.
Source code in src/antares/craft/model/study.py
delete_output
delete_output(output_name: str) -> None
delete_outputs
delete_xpansion_configuration
generate_thermal_timeseries
Generates timeseries for thermal clusters availability, based on timeseries generation parameters.
Parameters:
-
(nb_yearsint) –number of scenarios (years) to generate timeseries for.
Source code in src/antares/craft/model/study.py
get_areas
get_areas() -> MappingProxyType[str, Area]
Retrieve a dictionary of the study areas.
Returns:
-
MappingProxyType[str, Area]–A read-only mapping where keys are area names (str)
-
MappingProxyType[str, Area]–and values are
Areaobjects.
Source code in src/antares/craft/model/study.py
get_binding_constraints
get_binding_constraints() -> MappingProxyType[str, BindingConstraint]
Retrieve a dictionary of the binding constraints.
Returns:
-
MappingProxyType[str, BindingConstraint]–A read-only mapping where keys are binding constraints names (str)
-
MappingProxyType[str, BindingConstraint]–and values are
BindingConstraintobjects.
Source code in src/antares/craft/model/study.py
get_links
get_links() -> MappingProxyType[str, Link]
Retrieve a dictionary of the study links.
Returns:
-
MappingProxyType[str, Link]–A read-only mapping where keys are link names (str)
-
MappingProxyType[str, Link]–and values are
Linkobjects.
Source code in src/antares/craft/model/study.py
get_output
get_outputs
get_outputs() -> MappingProxyType[str, Output]
Get outputs of current study.
Returns:
-
MappingProxyType[str, Output]–Read-only proxy of the (output_id, Output) mapping.
get_scenario_builder
Get scenario builder.
Returns:
-
ScenarioBuilder–The current scenario builder used.
Source code in src/antares/craft/model/study.py
get_settings
get_settings() -> StudySettings
move
move(parent_path: Path) -> None
Moves the study to another directory.
Parameters:
-
(parent_pathPath) –New path to move the study to.
run_antares_simulation
run_antares_simulation(parameters: Optional[AntaresSimulationParameters] = None) -> Job
Runs the Antares simulation.
This method starts an antares simulation with the given parameters.
Parameters:
-
(parametersOptional[AntaresSimulationParameters], default:None) –The simulation parameters (solver, number of CPU...).
Returns:
-
Job–A job representing the simulation task.
Source code in src/antares/craft/model/study.py
set_playlist
set_playlist(playlist: dict[int, PlaylistParameters]) -> None
Set the playlist to give relative weights to each Monte Carlo year.
Parameters:
-
(playlistdict[int, PlaylistParameters]) –A mapping corresponding to the index of the MC year, and the
PlaylistParametersthat includes the weight of that year.
Source code in src/antares/craft/model/study.py
set_scenario_builder
set_scenario_builder(scenario_builder: ScenarioBuilder) -> None
Set scenario builder.
Parameters:
-
(scenario_builderScenarioBuilder) –The scenario builder to apply.
Source code in src/antares/craft/model/study.py
set_thematic_trimming
set_thematic_trimming(thematic_trimming: ThematicTrimmingParameters) -> None
Set a thematic trimming to select the outputs of the simulation.
Parameters:
-
(thematic_trimmingThematicTrimmingParameters) –Selection of the outputs.
Source code in src/antares/craft/model/study.py
update_areas
update_areas(new_properties: Dict[Area, AreaPropertiesUpdate]) -> None
Update existing areas properties.
Parameters:
-
(new_propertiesDict[Area, AreaPropertiesUpdate]) –a mapping of the area to its new properties.
Source code in src/antares/craft/model/study.py
update_binding_constraints
update_binding_constraints(
new_properties: Dict[str, BindingConstraintPropertiesUpdate],
) -> None
Update existing binding constraints.
Parameters:
-
(new_propertiesDict[str, BindingConstraintPropertiesUpdate]) –a dictionary of binding constraint ID to binding constraint update data
Source code in src/antares/craft/model/study.py
update_links
update_links(new_properties: Dict[str, LinkPropertiesUpdate]) -> None
Update existing links.
Parameters:
-
(new_propertiesDict[str, LinkPropertiesUpdate]) –A dictionary of link ID to link update data
Source code in src/antares/craft/model/study.py
update_renewable_clusters
update_renewable_clusters(
new_properties: dict[RenewableCluster, RenewableClusterPropertiesUpdate],
) -> None
Update existing renewable cluster properties.
Parameters:
-
(new_propertiesdict[RenewableCluster, RenewableClusterPropertiesUpdate]) –A dictionary of cluster to cluster update data.
Source code in src/antares/craft/model/study.py
update_settings
update_settings(settings: StudySettingsUpdate) -> None
Updates the study settings.
Parameters:
-
(settingsStudySettingsUpdate) –StudySettingsUpdate: New settings to be applied to the study configuration.
Source code in src/antares/craft/model/study.py
update_st_storages
update_st_storages(new_properties: dict[STStorage, STStoragePropertiesUpdate]) -> None
Update existing short-term storage.
Parameters:
-
(new_propertiesdict[STStorage, STStoragePropertiesUpdate]) –a dictionary of short-term storage ID to short-term storage update data.
Source code in src/antares/craft/model/study.py
update_st_storages_constraints
update_st_storages_constraints(
new_constraints: dict[STStorage, dict[str, STStorageAdditionalConstraintUpdate]],
) -> None
Update existing short-term storage constraints.
Parameters:
-
(new_constraintsdict[STStorage, dict[str, STStorageAdditionalConstraintUpdate]]) –a dictionary of short-term storage objects to a dictionary of ST storage ID to some additional constraint update on the ST storage.
Source code in src/antares/craft/model/study.py
update_thermal_clusters
update_thermal_clusters(
new_properties: dict[ThermalCluster, ThermalClusterPropertiesUpdate],
) -> None
Update existing thermal cluster properties.
Parameters:
-
(new_propertiesdict[ThermalCluster, ThermalClusterPropertiesUpdate]) –a dictionary of cluster to cluster update data.
Source code in src/antares/craft/model/study.py
wait_job_completion
Waits for the completion of a job.
Parameters:
-
(jobJob) –The job to wait for
-
(time_outint, default:172800) –Time limit for waiting (seconds), default: 172800s
Raises:
-
SimulationTimeOutError–if exceeded timeout
Source code in src/antares/craft/model/study.py
create_study_api
create_study_api(
study_name: str, version: str, api_config: APIconf, parent_path: Path | None = None
) -> Study
Creates a study on antares-web server.
Parameters:
-
(study_namestr) –the name of the created study
-
(versionstr) –the study version, for example "8.8"
-
(api_configAPIconf) –configuration to connect to antares-web server
-
(parent_pathPath | None, default:None) –an optional directory where the study will be stored in antares-web
Returns:
-
Study–a Study object representing the newly created study
Source code in src/antares/craft/model/study.py
create_study_local
create_study_local(
study_name: str, version: str, parent_directory: Path | str
) -> Study
Creates a new study on your filesystem.
Parameters:
-
(study_namestr) –the name of the created study
-
(versionstr) –the study version, for example "8.8"
-
(parent_directoryPath | str) –the directory where the new study will be created
Returns:
-
Study–a Study object representing the newly created study
Source code in src/antares/craft/model/study.py
create_variant_api
create_variant_api(api_config: APIconf, study_id: str, variant_name: str) -> Study
Creates a new variant of an existing study, on antares-web server.
Parameters:
-
(api_configAPIconf) –configuration to connect to antares-web server
-
(study_idstr) –the ID of the base study on antares-web
-
(variant_namestr) –the name of the newly created variant on antares-web
Returns:
-
Study–a Study object representing the newly created variant on antares-web
Source code in src/antares/craft/model/study.py
import_study_api
import_study_api(
api_config: APIconf, study_path: Path, destination_path: Path | None = None
) -> Study
Creates a study on antares-web server, by importing an existing study archive from your filesystem.
Parameters:
-
(api_configAPIconf) –configuration to connect to antares-web server
-
(study_pathPath) –path to your study, either as a .zip or .7z file
-
(destination_pathPath | None, default:None) –an optional directory where the study will be stored in antares-web
Returns:
-
Study–a Study object representing the newly created study
Source code in src/antares/craft/model/study.py
read_outputs_api
Reads all outputs for a given study from antares-web server.
Why use this method instead of read_study_api:
- It is more performant as it only retrieves output data
- It allows you to read outputs for wrongly formatted studies or old studies prior to Simulator v8.8
Parameters:
-
(api_configAPIconf) –configuration to connect to antares-web server
-
(study_idstr) –the ID of the study on antares-web
Returns:
Source code in src/antares/craft/model/study.py
read_outputs_local
Reads all outputs of an existing study on your filesystem.
Why use this method instead of read_study_local:
- It is more performant as it only retrieves output data
- It allows you to read outputs for wrongly formatted studies or old studies prior to Simulator v8.8
Parameters:
Returns:
Source code in src/antares/craft/model/study.py
read_study_api
read_study_api(api_config: APIconf, study_id: str) -> Study
Reads an existing study from antares-web server.
Parameters:
-
(api_configAPIconf) –configuration to connect to antares-web server
-
(study_idstr) –the ID of the study on antares-web
Returns:
-
Study–a Study object representing the study on antares-web
Source code in src/antares/craft/model/study.py
read_study_local
read_study_local(study_path: Path | str) -> Study
Reads an existing study on your filesystem.
Parameters:
Returns:
-
Study–a Study object representing the study on disk