Skip to content

Commit

Permalink
Reorg sciml calibrate (#2942)
Browse files Browse the repository at this point in the history
  • Loading branch information
mwdchang authored Mar 7, 2024
1 parent 6d1c716 commit 114d590
Show file tree
Hide file tree
Showing 3 changed files with 175 additions and 233 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
import { WorkflowPort, Operation, WorkflowOperationTypes } from '@/types/workflow';
// import type { CalibrationRequest } from '@/types/Types';
// import { makeCalibrateJob } from '@/services/models/simulation-service';
import { getModel } from '@/services/model';
import { Operation, WorkflowOperationTypes } from '@/types/workflow';

export interface CalibrateMap {
modelVariable: string;
Expand All @@ -28,8 +25,9 @@ export interface CalibrationOperationStateJulia {

// state specific to individual calibrate runs
extra: CalibrateExtraJulia;
simulationsInProgress: string[];
intermediateLoss?: Record<string, number>[];

inProgressSimulationId: string;
}

export const CalibrationOperationJulia: Operation = {
Expand All @@ -44,40 +42,19 @@ export const CalibrationOperationJulia: Operation = {
outputs: [{ type: 'simulationId' }],
isRunnable: true,

// TODO: Figure out mapping
// Calls API, returns results.
action: async (v: WorkflowPort[]) => {
// TODO Add more safety checks.
if (v.length) {
// TODO: The mapping is not 0 -> modelId as i am assuming here for testing
const modelId = v[0].value?.[0];
// let datasetId = v[1].value;
// let configuration = v[2].value; //TODO Not sure if this is a required input

// Get the model:
const model = await getModel(modelId);
if (model) {
// Make calibration job.
// const calibrationParam: CalibrationRequest = calibrationParamExample;
// const result = makeCalibrateJob(calibrationParam);
// return [{ type: 'number', result }];
return [{ type: null, value: null }];
}
}
return [{ type: null, value: null }];
},
action: async () => null,

initState: () => {
const init: CalibrationOperationStateJulia = {
chartConfigs: [],
inProgressSimulationId: '',
mapping: [{ modelVariable: '', datasetVariable: '' }],
extra: {
numChains: 4,
numIterations: 50,
odeMethod: 'default',
calibrateMethod: CalibrateMethodOptions.GLOBAL
},
simulationsInProgress: []
}
};
return init;
}
Expand Down
Loading

0 comments on commit 114d590

Please sign in to comment.