|
| 1 | +<template> |
| 2 | + <div> |
| 3 | + <div class="mb-3"> |
| 4 | + <p class="lead"> |
| 5 | + Comparison to Group Eddy_Quad Statistics |
| 6 | + </p> |
| 7 | + <p>Absolute Motion (z-score)</p> |
| 8 | + <b-progress class="w-50 mx-auto"> |
| 9 | + <b-progress-bar :value="scaleZ(individual_abs_mot_z)" |
| 10 | + :variant="getColor(0, individual_abs_mot_z)"> |
| 11 | + z = {{individual_abs_mot_z}} |
| 12 | + </b-progress-bar> |
| 13 | + </b-progress> |
| 14 | + </div> |
| 15 | + <div class="mb-3"> |
| 16 | + <p>Relative Motion (z-score)</p> |
| 17 | + <b-progress class="w-50 mx-auto"> |
| 18 | + <b-progress-bar :value="scaleZ(individual_rel_mot_z)" |
| 19 | + :variant="getColor(0, individual_rel_mot_z)"> |
| 20 | + z = {{individual_rel_mot_z}} |
| 21 | + </b-progress-bar> |
| 22 | + </b-progress> |
| 23 | + </div> |
| 24 | + |
| 25 | + </div> |
| 26 | +</template> |
| 27 | + |
| 28 | +<script> |
| 29 | +// import _ from 'lodash'; |
| 30 | +const d3 = require('d3'); |
| 31 | +
|
| 32 | +export default { |
| 33 | + name: 'GroupStats', |
| 34 | + props: ['data', 'individual'], |
| 35 | + data() { |
| 36 | + return { |
| 37 | +
|
| 38 | + }; |
| 39 | + }, |
| 40 | + methods: { |
| 41 | + scaleZ(val) { |
| 42 | + const scaler = d3.scaleLinear().range([0, 100]).domain([-3, 3]); |
| 43 | + return scaler(val); |
| 44 | + }, |
| 45 | + getColor(direction, zScore) { |
| 46 | + if (direction) { |
| 47 | + console.log(zScore); |
| 48 | + // positive is good |
| 49 | + if (zScore <= -1) { |
| 50 | + return 'danger'; |
| 51 | + } else if (zScore >= 1) { |
| 52 | + return 'success'; |
| 53 | + } |
| 54 | + } |
| 55 | + console.log('here', zScore); |
| 56 | + if (zScore <= -1) { |
| 57 | + return 'success'; |
| 58 | + } else if (zScore >= 1) { |
| 59 | + return 'danger'; |
| 60 | + } |
| 61 | + return 'primary'; |
| 62 | + }, |
| 63 | + }, |
| 64 | + computed: { |
| 65 | + mean_group_abs_mot() { |
| 66 | + return d3.mean(this.data, d => d.qc_mot_abs); |
| 67 | + }, |
| 68 | + std_group_abs_mot() { |
| 69 | + return d3.deviation(this.data, d => d.qc_mot_abs); |
| 70 | + }, |
| 71 | + individual_abs_mot_z() { |
| 72 | + if (this.individual) { |
| 73 | + return (this.individual.qc_mot_abs - this.mean_group_abs_mot) / this.std_group_abs_mot; |
| 74 | + } |
| 75 | + return null; |
| 76 | + }, |
| 77 | + mean_group_rel_mot() { |
| 78 | + return d3.mean(this.data, d => d.qc_mot_rel); |
| 79 | + }, |
| 80 | + std_group_rel_mot() { |
| 81 | + return d3.deviation(this.data, d => d.qc_mot_rel); |
| 82 | + }, |
| 83 | + individual_rel_mot_z() { |
| 84 | + if (this.individual) { |
| 85 | + return (this.individual.qc_mot_rel - this.mean_group_rel_mot) / this.std_group_rel_mot; |
| 86 | + } |
| 87 | + return null; |
| 88 | + }, |
| 89 | + }, |
| 90 | +}; |
| 91 | +</script> |
| 92 | + |
| 93 | +<style> |
| 94 | +</style> |
0 commit comments