Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: pivot/matrix improvement for Catlab stratify #1601

Merged
merged 9 commits into from
Jul 29, 2023
Merged

feat: pivot/matrix improvement for Catlab stratify #1601

merged 9 commits into from
Jul 29, 2023

Conversation

mwdchang
Copy link
Member

@mwdchang mwdchang commented Jul 28, 2023

Summary

Rewriting the pivot table/matrix extract from Catlab as recursive function go get all past stratification schemes.

import { ref } from 'vue';
import { createMatrix2D } from '@/utils/pivot';
import { amr } from '@/temp/catlab-strata-x2';
import {
	getCatlabTransitionsMatrixData,
	getCatlabStatesMatrixData
} from '@/model-representation/petrinet/petrinet-service';

const statesMatrixData = getCatlabStatesMatrixData(amr as any);
const transitionsMatrixData = getCatlabTransitionsMatrixData(amr as any);

console.log('states', JSON.stringify(statesMatrixData));
console.log('transitions', transitionsMatrixData);

const xDim = ['Age-contact strata model', 'Location-travel strata model'];
const yDim = ['Age-contact strata model', 'Location-travel strata model'];
const result = createMatrix2D(
	transitionsMatrixData.filter((d) => d['@base'] === 'inf'),
	xDim,
	yDim
);
const rows = ref<any>(result.matrix);

@mwdchang mwdchang changed the title Pivot 2 feat: pivot/matrix improvement for Catlab stratify Jul 28, 2023
@mwdchang mwdchang marked this pull request as ready for review July 28, 2023 16:56
@mwdchang mwdchang requested a review from YohannParis as a code owner July 28, 2023 16:56
@mwdchang mwdchang requested review from shawnyama and echl July 28, 2023 16:56
@mwdchang mwdchang merged commit 3ae4fad into main Jul 29, 2023
@mwdchang mwdchang deleted the pivot-2 branch July 29, 2023 17:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants