annotate jnmr/BayesianArrayStructure.h @ 52:13194a9dca77 tip

Added exporting of image and text data
author Andrew N Robertson <andrew.robertson@eecs.qmul.ac.uk>
date Tue, 17 Jul 2012 22:13:10 +0100
parents 158f5f38e9d3
children
rev   line source
andrew@33 1 /*
andrew@33 2 * BayesianArrayStructure.h
andrew@33 3 * midiCannamReader
andrew@33 4 *
andrew@33 5 * Created by Andrew on 17/07/2011.
andrew@33 6 * Copyright 2011 QMUL. All rights reserved.
andrew@33 7 *
andrew@33 8 */
andrew@33 9 #ifndef BAYESIAN_ARRAY_STRUCTURE
andrew@33 10 #define BAYESIAN_ARRAY_STRUCTURE
andrew@33 11
andrew@33 12
andrew@33 13 #include "ofMain.h"
andrew@33 14 //#include "DynamicBayesianArray.h"
andrew@33 15 #include "DynamicVector.h"
andrew@33 16
andrew@33 17 class BayesianArrayStructure {
andrew@33 18
andrew@33 19 public:
andrew@33 20 // BayesianArrayStructure();
andrew@33 21 BayesianArrayStructure();
andrew@33 22 BayesianArrayStructure(int length);
andrew@33 23
andrew@33 24 void calculatePosterior();
andrew@33 25 void drawArrays();
andrew@33 26 void drawArraysRelativeToTimeframe(const double& startTimeMillis, const double& endTimeMillis);
andrew@33 27
andrew@33 28 void drawTempoArrays();
andrew@33 29
andrew@33 30 void resetSize(int length);
andrew@33 31 void resetArrays();
andrew@33 32 void simpleExample();
andrew@33 33 void setStartPlaying();
andrew@33 34 void zeroArrays();
andrew@33 35
andrew@33 36 double screenWidth;
andrew@33 37
andrew@33 38 void copyPriorToPosterior();
andrew@33 39 // DynamicBayesianArray bayesArray;
andrew@33 40
andrew@33 41 double lastEventTime;
andrew@33 42 double likelihoodNoise;
andrew@33 43 double speedLikelihoodNoise;
andrew@33 44
andrew@33 45 //DynamicVector tmpPrior;
andrew@33 46 DynamicVector tmpPosteriorForStorage;
andrew@33 47 DynamicVector prior;
andrew@33 48 DynamicVector posterior;
andrew@33 49 DynamicVector likelihood;
andrew@33 50
andrew@33 51 DynamicVector relativeSpeedPrior;
andrew@33 52 DynamicVector relativeSpeedLikelihood;
andrew@33 53 DynamicVector relativeSpeedPosterior;
andrew@33 54 DynamicVector acceleration;
andrew@33 55
andrew@33 56 double tmpBestEstimate;
andrew@46 57 // void updateTmpBestEstimate(const double& timeDifference); DELETE
andrew@33 58
andrew@33 59 int updateCounter;
andrew@33 60
andrew@33 61 void setPositionDistributionScalar(double f);
andrew@33 62
andrew@33 63 void resetSpeedToOne();
andrew@33 64 void addGaussianNoiseToSpeedPosterior(const double& std_dev);
andrew@33 65 void addTriangularNoiseToSpeedPosterior(const double& std_dev);
andrew@33 66
andrew@33 67 double bestEstimate;
andrew@33 68 void updateBestEstimate(const double& timeDifference);
andrew@33 69 double lastBestEstimateUpdateTime;
andrew@34 70 double speedEstimate, speedEstimateIndex;
andrew@46 71 double getSpeedEstimateIndex();
andrew@33 72
andrew@33 73 double speedDecayWidth, speedDecayAmount;
andrew@33 74 void decaySpeedDistribution(double timeDifference);
andrew@33 75
andrew@33 76 void resetSpeedSize(int length);
andrew@33 77 void setRelativeSpeedScalar(double f);
andrew@33 78 void setSpeedPrior(double f);
andrew@46 79 //void calculateNewPriorOffset(const double& timeDifference);
andrew@33 80 void setNewDistributionOffsets(const double& newOffset);
andrew@33 81
andrew@33 82 void setLikelihoodToConstant();
andrew@33 83 void updateTempoLikelihood(const double& speedRatio, const double& matchFactor);
andrew@33 84 void updateTempoDistribution();
andrew@33 85
andrew@33 86 void calculateTempoUpdate();
andrew@33 87
andrew@33 88 void crossUpdateArrays(DynamicVector& position, DynamicVector& speed, double timeDifference);
andrew@33 89 void complexCrossUpdate(const double& timeDifferenceInPositionVectorUnits);
andrew@33 90 void translateByMaximumSpeed(const double& timeDifferenceInPositionVectorUnits);
andrew@33 91 double crossUpdateTimeThreshold;//time after which we do complex update of multiple speeds
andrew@33 92
andrew@33 93 double speedPriorValue;
andrew@33 94 int priorWidth;
andrew@33 95 bool* realTimeMode;
andrew@33 96 bool usingIntegratedTempoEstimate;
andrew@33 97 double relativeSpeedLikelihoodStdDev;
andrew@50 98 bool useConstantTempoDistribution;
andrew@52 99
andrew@52 100 bool drawLikelihood;
andrew@52 101 bool drawPrior;
andrew@52 102 bool drawPosterior;
andrew@33 103 };
andrew@33 104 #endif