-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ensemble Calibrate - Intermediate Results (#5401)
- Loading branch information
1 parent
e397bf3
commit 8b1929a
Showing
4 changed files
with
150 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
...i-client/src/components/workflow/ops/calibrate-ensemble-ciemss/calibrate-ensemble-util.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import { createForecastChart, AUTOSIZE } from '@/services/charts'; | ||
import { getSimulation } from '@/services/models/simulation-service'; | ||
|
||
export async function getLossValuesFromSimulation(calibrationId: string) { | ||
if (!calibrationId) return []; | ||
const simulationObj = await getSimulation(calibrationId); | ||
if (simulationObj?.updates) { | ||
const lossValues = simulationObj?.updates | ||
.sort((a, b) => a.data.progress - b.data.progress) | ||
.map((d, i) => ({ | ||
iter: i, | ||
loss: d.data.loss | ||
})); | ||
return lossValues; | ||
} | ||
return []; | ||
} | ||
|
||
export const updateLossChartSpec = (data: string | Record<string, any>[], size: { width: number; height: number }) => | ||
createForecastChart( | ||
null, | ||
{ | ||
data: Array.isArray(data) ? data : { name: data }, | ||
variables: ['loss'], | ||
timeField: 'iter' | ||
}, | ||
null, | ||
{ | ||
title: '', | ||
width: size.width, | ||
height: 100, | ||
xAxisTitle: 'Solver iterations', | ||
yAxisTitle: 'Loss', | ||
autosize: AUTOSIZE.FIT, | ||
fitYDomain: true | ||
} | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters