Skip to content

Commit

Permalink
Adjusted EnsembleSensitivities accordingly
Browse files Browse the repository at this point in the history
  • Loading branch information
rubenthoms committed Oct 10, 2023
1 parent 6364c2a commit f3aa6cc
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 14 deletions.
8 changes: 4 additions & 4 deletions frontend/src/framework/Ensemble.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { EnsembleIdent } from "./EnsembleIdent";
import { EnsembleParameterSet, Parameter } from "./EnsembleParameterSet";
import { EnsembleSensitivities, Sensitivity } from "./EnsembleSensitivities";
import { EnsembleSensitivitySet, Sensitivity } from "./EnsembleSensitivities";

export class Ensemble {
private _ensembleIdent: EnsembleIdent;
private _caseName: string;
private _realizationsArr: number[];
private _parameterSet: EnsembleParameterSet;
private _sensitivities: EnsembleSensitivities | null;
private _sensitivities: EnsembleSensitivitySet | null;

constructor(
caseUuid: string,
Expand All @@ -24,7 +24,7 @@ export class Ensemble {

this._sensitivities = null;
if (sensitivityArr && sensitivityArr.length > 0) {
this._sensitivities = new EnsembleSensitivities(sensitivityArr);
this._sensitivities = new EnsembleSensitivitySet(sensitivityArr);
}
}

Expand Down Expand Up @@ -68,7 +68,7 @@ export class Ensemble {
return this._parameterSet;
}

getSensitivities(): EnsembleSensitivities | null {
getSensitivitySet(): EnsembleSensitivitySet | null {
return this._sensitivities;
}
}
2 changes: 1 addition & 1 deletion frontend/src/framework/EnsembleSensitivities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export type Sensitivity = {
readonly cases: SensitivityCase[];
};

export class EnsembleSensitivities {
export class EnsembleSensitivitySet {
private _sensitivityArr: Sensitivity[];

constructor(sensitivityArr: Sensitivity[]) {
Expand Down
7 changes: 5 additions & 2 deletions frontend/src/modules/DbgWorkbenchSpy/implementation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,10 @@ export function WorkbenchSpyView(props: ModuleFCProps<SharedState>) {
<tbody>
{makeTableRow("hoverRealization", hoverRealization?.realization, hoverRealization_TS)}
{makeTableRow("hoverTimestamp", hoverTimestamp?.timestampUtcMs, hoverTimestamp_TS)}
{makeTableRow("hoverTimestamp isoStr", hoverTimestamp ? timestampUtcMsToIsoString(hoverTimestamp.timestampUtcMs) : "UNDEF")}
{makeTableRow(
"hoverTimestamp isoStr",
hoverTimestamp ? timestampUtcMsToIsoString(hoverTimestamp.timestampUtcMs) : "UNDEF"
)}
</tbody>
</table>
<br />
Expand Down Expand Up @@ -84,7 +87,7 @@ function makeEnsembleSetTable(ensembleSet: EnsembleSet) {
<td> {ens.getEnsembleName()} </td>
<td> ({ens.getCaseUuid()}) </td>
<td> {ens.getRealizations().length} realizations</td>
<td> {ens.getSensitivities() ? "HasSens" : "noSense"}</td>
<td> {ens.getSensitivitySet() ? "HasSens" : "noSense"}</td>
</tr>
))}
</tbody>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ export function settings({ moduleContext, workbenchSession, workbenchServices }:
const computedVectorTag = candidateVectorTag;

const computedEnsemble = computedEnsembleIdent ? ensembleSet.findEnsemble(computedEnsembleIdent) : null;
const sensitivityNames = computedEnsemble?.getSensitivities()?.getSensitivityNames() ?? [];
const sensitivityNames = computedEnsemble?.getSensitivitySet()?.getSensitivityNames() ?? [];
React.useEffect(
function setSensitivitiesOnEnsembleChange() {
if (!isEqual(selectedSensitivities, sensitivityNames)) {
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/modules/SimulationTimeSeriesSensitivity/view.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ export const view = ({
);
const colorSet = workbenchSettings.useColorSet();

const allSensitivityNamesInEnsemble = ensemble?.getSensitivities()?.getSensitivityNames().sort() ?? [];
const allSensitivityNamesInEnsemble = ensemble?.getSensitivitySet()?.getSensitivityNames().sort() ?? [];

const traceDataArr: TimeSeriesPlotlyTrace[] = [];
if (ensemble && selectedSensitivities && selectedSensitivities.length > 0) {
Expand All @@ -125,7 +125,7 @@ export const view = ({
}

// Add realization traces
const sensitivity = ensemble.getSensitivities()?.getSensitivityByName(sensitivityName);
const sensitivity = ensemble.getSensitivitySet()?.getSensitivityByName(sensitivityName);
if (showRealizations && realizationsQuery.data && sensitivity) {
for (const sensCase of sensitivity.cases) {
const realsToInclude = sensCase.realizations;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
import { EnsembleSensitivities, Sensitivity, SensitivityCase, SensitivityType } from "@framework/EnsembleSensitivities";
import {
EnsembleSensitivitySet,
Sensitivity,
SensitivityCase,
SensitivityType,
} from "@framework/EnsembleSensitivities";
import { computeQuantile } from "@modules_shared/statistics";

export type EnsembleScalarResponse = {
Expand Down Expand Up @@ -42,12 +47,12 @@ export class SensitivityResponseCalculator {
* Class for calculating sensitivities for a given Ensemble response
*/
private _ensembleResponse: EnsembleScalarResponse;
private _sensitivities: EnsembleSensitivities;
private _sensitivities: EnsembleSensitivitySet;
private _referenceSensitivity: string;
private _referenceAverage: number;

constructor(
sensitivities: EnsembleSensitivities,
sensitivities: EnsembleSensitivitySet,
ensembleResponse: EnsembleScalarResponse,
referenceSensitivity = "rms_seed"
) {
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/modules/TornadoChart/view.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ export const view = ({
return unsubscribeFunc;
}, [responseChannel, ensembleSet]);

const sensitivities = channelEnsemble?.getSensitivities();
const sensitivities = channelEnsemble?.getSensitivitySet();
const colorSet = workbenchSettings.useColorSet();
const sensitivitiesColorMap = createSensitivityColorMap(
sensitivities?.getSensitivityNames().sort() ?? [],
Expand Down

0 comments on commit f3aa6cc

Please sign in to comment.