/*This method does the three steps involved in initializing weights. Subclasses usually don't need to override this method. * Instead they should override calcWeights to do their own type of weight initialization. * * For KernelConns (i.e., sharedWeights=true), patches should be NULL. * */ int InitWeights::initializeWeights(PVPatch *** patches, pvwdata_t ** dataStart, double * timef /*default NULL*/) { PVParams * inputParams = callingConn->getParent()->parameters(); int numPatches = callingConn->getNumDataPatches(); if (inputParams->present(callingConn->getName(), "initFromLastFlag")) { if (callingConn->getParent()->columnId()==0) { fprintf(stderr, "Connection \"%s\": initFromLastFlag is obsolete.\n", callingConn->getName()); } if (inputParams->value(callingConn->getName(), "initFromLastFlag")) { if (callingConn->getParent()->columnId()==0) { fprintf(stderr, "Instead, use weightInitType=\"FileWeight\" or set HyPerCol initializeFromCheckpointDir and set initializeFromCheckpointFlag to true\n"); } MPI_Barrier(callingConn->getParent()->icCommunicator()->communicator()); exit(EXIT_FAILURE); } } if (weightParams->getFilename() != NULL && weightParams->getFilename()[0]) { readWeights(patches, dataStart, numPatches, weightParams->getFilename(), timef); } else { initRNGs(patches==NULL); calcWeights(); } // filename != null int successFlag = zeroWeightsOutsideShrunkenPatch(patches); if (successFlag != PV_SUCCESS) { fprintf(stderr, "Failed to zero annulus around shrunken patch for %s! Exiting...\n", callingConn->getName()); exit(PV_FAILURE); } return PV_SUCCESS; }
void ContiguousMS::ReadWeights(float* buffer) { readMeta(); readData(); readWeights(); size_t startChannel, endChannel; if(_selection.HasChannelRange()) { startChannel = _selection.ChannelRangeStart(); endChannel = _selection.ChannelRangeEnd(); } else { startChannel = 0; endChannel = _bandData[_dataDescId].ChannelCount(); } copyWeights(buffer, startChannel, endChannel, _inputPolarizations, _dataArray, _weightSpectrumArray, _flagArray, _polOut); }
void ContiguousMS::ReadModel(std::complex<float>* buffer) { if(!_isModelColumnPrepared) prepareModelColumn(); readMeta(); readModel(); readWeights(); size_t startChannel, endChannel; if(_selection.HasChannelRange()) { startChannel = _selection.ChannelRangeStart(); endChannel = _selection.ChannelRangeEnd(); } else { startChannel = 0; endChannel = _bandData[_dataDescId].ChannelCount(); } copyData(buffer, startChannel, endChannel, _inputPolarizations, _modelArray, _polOut); }
void checkOptions(Options& opts, int argc, char* argv[]) { opts.define("a|all=b", "show all scores"); opts.define("Aarden|aarden|aa=b", "use Aarden profiles"); opts.define("Bellman|bellman|bb=b","use Bellman profiles"); opts.define("Krumhansl|k|kk=b", "use Krumhansl-Kessler profiles"); opts.define("Temperley|temperley|kp|=b","use Kostka-Payne profiles"); opts.define("G|gabura|raw=b", "use raw correlation"); opts.define("n|normalize=b", "normalize raw correlation input data"); opts.define("e|euclidean=b", "euclidean keyfinding method"); opts.define("s|simple=b", "do simple profile"); opts.define("D|no-duration=b", "ignore duration of notes in input"); opts.define("f|frequency|freq=b", "show pitch frequencies"); opts.define("F|Freq=b", "pitch frequencies MMA by fifths"); opts.define("w|weights=s:", "weighting factor file"); opts.define("step=d:1.0", "step size for continuous analysis"); opts.define("window=i:32", "window size for continuous analysis"); opts.define("c|continuous=b", "continuous analysis"); opts.define("R|no-round=b", "don't round correlation values"); opts.define("l|name=b", "print filenames"); opts.define("error|errors=b", "print * marker on analyses which are errors"); opts.define("debug=b", "trace input parsing"); opts.define("author=b", "author of the program"); opts.define("version=b", "compilation information"); opts.define("example=b", "example usage"); opts.define("h|help=b", "short description"); opts.process(argc, argv); // handle basic options: if (opts.getBoolean("author")) { cout << "Written by Craig Stuart Sapp, " << "[email protected], May 2001" << endl; exit(0); } else if (opts.getBoolean("version")) { cout << argv[0] << ", version: 26 May 2009" << endl; cout << "compiled: " << __DATE__ << endl; cout << MUSEINFO_VERSION << endl; exit(0); } else if (opts.getBoolean("help")) { usage(opts.getCommand().data()); exit(0); } else if (opts.getBoolean("example")) { example(); exit(0); } allQ = opts.getBoolean("all"); rhythmQ = !opts.getBoolean("no-duration"); frequencyQ = opts.getBoolean("frequency"); if (opts.getBoolean("F")) { frequencyQ = 1; mmaQ = 1; } rawQ = opts.getBoolean("raw"); normalizeQ = opts.getBoolean("normalize"); euclideanQ = opts.getBoolean("euclidean"); continuousQ = opts.getBoolean("continuous"); windowsize = opts.getInteger("window"); stepsize = opts.getDouble("step"); roundQ = !opts.getBoolean("no-round"); debugQ = opts.getBoolean("debug"); nameQ = opts.getBoolean("name"); errorQ = opts.getBoolean("error"); if (opts.getBoolean("Krumhansl")) { majorKey = majorKeyKrumhansl; minorKey = minorKeyKrumhansl; } else if (opts.getBoolean("Aarden")) { majorKey = majorKeyAarden; minorKey = minorKeyAarden; } else if (opts.getBoolean("simple")) { majorKey = majorKeySimple; minorKey = minorKeySimple; } else if (opts.getBoolean("Bellman")) { majorKey = majorKeyBellman; minorKey = minorKeyBellman; } else if (opts.getBoolean("Temperley")) { majorKey = majorKeyKostkaPayne; minorKey = minorKeyKostkaPayne; } else if (opts.getBoolean("weights")) { readWeights(opts.getString("weights").data()); majorKey = majorKeyUser; minorKey = minorKeyUser; } else { // default weightings set at start of main(). } }