void pixelVariationHighRange(const char *filenameOld = "../../../rootFiles/LRScanOldSettings2.root", const char *filenameNew = "../../../rootFiles/LRScanNewSettings.root") { TFile *f1 = new TFile(filenameOld); TFile *f2 = new TFile(filenameNew); Init(); TLegend *legend = new TLegend(0.65,0.6,0.95,0.95); color = 3; TH1D *oldSettings = Analysis(f1); color = 2; TH1D *newSettings = Analysis(f2); legend->AddEntry(oldSettings,"oldSettings","L"); legend->AddEntry(newSettings,"newSettings","L"); canvas->Clear(); oldSettings->Draw(); newSettings->Draw("same"); legend->Draw(); canvas->SaveAs("qualityHist.png"); }
BOOL DChk::Load(STRCPTR name) { if (m_File) return FALSE; if (!name) return FALSE; HANDLE file = ::g_Archive.OpenFile(name); if (!file) return FALSE; UINT size = ::g_Archive.GetFileSize(file); if (size <= sizeof(SECTIONHEADER)) { ::g_Archive.CloseFile(file); return FALSE; } if (!Analysis(file, size) || !m_SectionTable.size()) { Clear(); return FALSE; } m_File = file; return TRUE; }
void Coach::update(SSL_DetectionFrame newFrame) { //update memory if(_memory.size() < 5) { _memory.push_back(newFrame); } else { _memory.push_back(newFrame); _memory.erase(_memory.begin()); //update FieldState fs.bBots.clear(); fs.yBots.clear(); fs.ball = Movable(newFrame.balls(0).x(), newFrame.balls(0).y(), 0, 0); //velocity calculated in analysis for(int i = 0; i < _memory[4].robots_blue_size(); i++) { fs.bBots.push_back(Robot(_memory[4].robots_blue(i).robot_id(), _memory[4].robots_blue(i).orientation(), _memory[4].robots_blue(i).x(), _memory[4].robots_blue(i).y())); } for(int i = 0; i < _memory[4].robots_yellow_size(); i++) { fs.yBots.push_back(Robot(_memory[4].robots_yellow(i).robot_id(), _memory[4].robots_yellow(i).orientation(), _memory[4].robots_yellow(i).x(), _memory[4].robots_yellow(i).y())); } //call analysis to update velocity Analysis(); } }
void NaturalNestedDissection ( Int nx, Int ny, Int nz, const DistGraph& graph, DistMap& map, DistSeparator& sep, DistNodeInfo& node, Int cutoff, bool storeFactRecvInds ) { EL_DEBUG_CSE // NOTE: There is a potential memory leak here if sep or info is reused DistMap perm( graph.NumSources(), graph.Comm() ); const Int firstLocalSource = perm.FirstLocalSource(); const Int numLocalSources = perm.NumLocalSources(); for( Int s=0; s<numLocalSources; ++s ) perm.SetLocal( s, s+firstLocalSource ); NaturalNestedDissectionRecursion ( nx, ny, nz, graph, perm, sep, node, 0, cutoff ); // Construct the distributed reordering BuildMap( sep, map ); EL_DEBUG_ONLY(EnsurePermutation(map)) // Run the symbolic analysis Analysis( node, storeFactRecvInds ); }
void NaturalNestedDissection ( Int nx, Int ny, Int nz, const Graph& graph, vector<Int>& map, Separator& sep, NodeInfo& node, Int cutoff ) { EL_DEBUG_CSE // NOTE: There is a potential memory leak here if sep or info is reused const Int numSources = graph.NumSources(); vector<Int> perm( numSources ); for( Int s=0; s<numSources; ++s ) perm[s] = s; NaturalNestedDissectionRecursion ( nx, ny, nz, graph, perm, sep, node, 0, cutoff ); // Construct the distributed reordering BuildMap( sep, map ); EL_DEBUG_ONLY(EnsurePermutation( map )) // Run the symbolic analysis Analysis( node ); }
/* AYW -- 2013-01-08 18:07 JST * Include laststep in argument */ void CheckForAnalysis (Data *d, Input *ini, Grid *grid, char last_step) //void CheckForAnalysis (Data *d, Input *ini, Grid *grid) /* -- AYW */ /* * * PURPOSE * * Check if Analysis needs to be called * ********************************************************************** */ { int check_dt, check_dn; double t, tnext; t = g_time; tnext = t + g_dt; check_dt = (int) (tnext/ini->anl_dt) - (int)(t/ini->anl_dt); check_dt = check_dt || g_stepNumber == 0 || fabs(t - ini->tstop) < 1.e-9; check_dt = check_dt && (ini->anl_dt > 0.0); check_dn = (g_stepNumber%ini->anl_dn) == 0; check_dn = check_dn && (ini->anl_dn > 0); /* AYW -- 2013-01-08 18:04 JST * Last step condition from main loop */ if (check_dt || check_dn || last_step) Analysis (d, grid); //if (check_dt || check_dn) Analysis (d, grid); /* -- AYW */ }
void LL(node_ptr &head,LinkQueue hword)// { cout<<"LL(1)文法判断:"<<endl; kong *k=NULL; list *first=NULL; list *follow=NULL; selist *select=NULL; built(head,first,follow,1);//建立first builtKong(first,k);//根据first 建立非终结符是否能推出空的表格 built(head,first,follow,0);//建follow builtSelect(head,first,follow,select,k);//建立select kong *p=k; while(p) { cout<<p->ch<<" "<<p->b<<endl; p=p->next; } system("pause"); cout<<"FIRST:"<<endl; Display(first); system("pause"); cout<<"FOLLOW:"<<endl; Display(follow); system("pause"); cout<<"SELECT:"<<endl; selist *pf=select; while(pf) { cout<<setiosflags(ios_base::left)<<setw(10)<<pf->Vn<<": "; cout<<pf->Vt<<endl; pf=pf->next; } system("pause"); judge(select);//通过select判断是否为LL(1)文法 selist *analy=NULL; Prediction(select,analy);//通过select建立预测分析表 Analysis(analy,hword);//通过分析表开始分析 }
void pixelVariationLowRange(const char *filenameOld = "../rootFiles/LRLScanOldSettings.root", const char *filenameNew = "../rootFiles/LRLScanNewSettings.root", const char *filenameMedium = "../rootFiles/LRLScanOldSettings.root") { TFile *f1 = new TFile(filenameOld); TFile *f2 = new TFile(filenameNew); TFile *f3 = new TFile(filenameMedium); Init(); TLegend *legend = new TLegend(0.65,0.6,0.95,0.95); cout << "test" << endl; color = 4; TH1D *oldSettings = Analysis(f1); color = 1; TH1D *newSettings = Analysis(f2); color = 2; TH1D *mediumSettings = Analysis(f3); cout << "Entries old settings = " << oldSettings->GetEntries() << endl; cout << "Entries medium settings = " << mediumSettings->GetEntries() << endl; cout << "Entries new settings = " << newSettings->GetEntries() << endl; legend->AddEntry(oldSettings,"oldSettings","L"); legend->AddEntry(mediumSettings,"mediumSettings","L"); legend->AddEntry(newSettings,"newSettings","L"); newSettings->GetYaxis()->SetTitleOffset(1.2); canvas->Clear(); newSettings->Draw(); oldSettings->Draw("same"); mediumSettings->Draw("same"); legend->Draw(); canvas->SaveAs("aoverb.png"); canvas->SaveAs("aoverb.root"); }
void TSymptom::Process() { awpImage* pbg = m_background.GetImage(); awpImage* pcr = m_current.GetImage(); awpImage* pdf = m_diff.GetImage(); awpImage* pbn = m_binary.GetImage(); awpImage* pbns = m_binary_source.GetImage(); _awpZeroImage(pbn); _awpZeroImage(pbns); _awpZeroImage(pdf); if (pbg == NULL || pcr == NULL || pdf == NULL || pbn == NULL) return; if (pbg->sSizeX != pcr->sSizeX || pbg->sSizeY != pcr->sSizeY) return; //вычисление разницы между полученным изображением и эталонным. AbsDiff(); if (m_NumFrames < m_NumFramesToTraining) return; //нахождение бинарного изображения _awpAdaptiveThreshold(pdf, pbns); ::awpCopyImage(pbns, &pbn); _awpNoiseRemove(pbns); //awpGaussianBlur(pbns, pbn,2); #ifdef _DEBUG m_background.SaveImage("background.jpg"); m_current.SaveImage("Current.jpg"); m_diff.SaveImage("diff.jpg"); m_binary.SaveImage("binary.jpg"); m_binary_source.SaveImage("binary_source.jpg"); #endif // сопровождение найденных объектов for (int i = 0; i < m_BLOBs.GetCount(); i++) { TLFBLOBObject* bo = (TLFBLOBObject*)m_BLOBs.Get(i); bo->TrackBLOB(NULL); } // вычисление интегрального изображения. // todo: удаление областей на бинарном изображении, занятых объектами. ApplyMask(pbn); // анализ полученного бинарного изображения // нахождение новых объектов Analysis(NULL); }
// convert vabamorf base library output to WordAnalysis instances, which as easier to wrap. std::vector<WordAnalysis> convertOutput(CFSArray<CFSVar>& words) { std::vector<WordAnalysis> results; results.reserve(words.GetSize()); for (int widx=0 ; widx < words.GetSize() ; ++widx) { CFSVar word = words[widx]; CFSVar analysis = word["analysis"]; AnalysisVector vec; for (int aidx=0 ; aidx < analysis.GetSize() ; ++aidx) { CFSVar a = analysis[aidx]; vec.push_back(Analysis(a["root"].GetAString(), a["ending"].GetAString(), a["clitic"].GetAString(), a["partofspeech"].GetAString(), a["form"].GetAString())); } results.push_back(WordAnalysis(std::string(word["text"].GetAString()), vec)); } return results; }
int Spectral_ExecuteAnalysis(signal_t *orig_signal, int target_iters, int windowing_type, Period_t ***DetectedPeriods) { signal_t *signal = NULL; spectral_time_t timeShifted = 0, totalTime = 0; /* Input signal is cloned because shifting (and windowing) modifies it */ signal = Spectral_CloneSignal( orig_signal ); timeShifted = Spectral_ShiftSignal( signal ); #if defined(DEBUG_MODE) fprintf(stdout, "Signal shifted " FORMAT_TIME " ns\n", timeShifted); #endif totalTime = Spectral_GetSignalTime( signal ); if (windowing_type != WINDOWING_NONE) { applyWindowing( signal, windowing_type ); } spectral_value_t *wavelet_samples = NULL; Sampler_wavelet(signal, &wavelet_samples, 1024, NULL); /* 1024 or 4096 */ int sizeSig2; Wavelet(wavelet_samples, 1024, &sizeSig2, "wavelet.txt"); int m = 0; int pfound; long long int period; FILE *out; FILE *err; long long int t0, t1; char *signalout = "/dev/null"; int numPeriods = 0; Period_t **listPeriods = NULL, *foundPeriod = NULL; while (m < sizeSig2) { double f1 = wavelet_samples[m]; double f2 = wavelet_samples[m+1]; if (f1 < f2) { spectral_time_t c = signal->data[0].time + totalTime * f1; spectral_time_t d = signal->data[0].time + totalTime * f2; out = fopen ("report.out", "w"); err = fopen ("report.err", "w"); foundPeriod = Analysis(signal, c/1000000, d/1000000, (d-c)/1000000, c/1000000, d/1000000, NULL, NULL, 1, NULL, &pfound, &period, signalout, &t0, &t1, NULL, out, err, 0, target_iters, 0, 0); if (foundPeriod != NULL) { numPeriods ++; listPeriods = realloc(listPeriods, numPeriods * sizeof(Period_t *)); listPeriods[numPeriods - 1] = foundPeriod; /* Reapply the time shift to the results */ foundPeriod->ini += timeShifted; foundPeriod->end += timeShifted; foundPeriod->best_ini += timeShifted; foundPeriod->best_end += timeShifted; fprintf(stdout, "PERIOD %d: iters=%f length=%lld g=%lf g2=%lf g3=%lf ini=%lld end=%lld best_ini=%lld best_end=%lld\n", numPeriods, foundPeriod->iters, foundPeriod->length, foundPeriod->goodness, foundPeriod->goodness2, foundPeriod->goodness3, foundPeriod->ini, foundPeriod->end, foundPeriod->best_ini, foundPeriod->best_end); } fclose(out); fclose(err); } m += 2; } fprintf(stdout, "%d period(s) found.\n", numPeriods); Spectral_FreeSignal(signal); *DetectedPeriods = listPeriods; return numPeriods; }
/** * 引数解析 */ BOOL COption::Analysis(int argc, char* argv[]) { for (int i = 1; i < argc; i++) { BOOL result = FALSE; izanagi::tool::CString cmd(argv[i]); if (i < argc - 1) { if (result = (cmd == "-c")) { // -c compiler.format("%s", argv[i + 1]); i++; } else if (result = (cmd == "-co")) { // -co compileOpt.format("%s", argv[i + 1]); i++; } else if (result = (cmd == "-I")) { // -I izanagi::tool::CString tmp; tmp.format("%s", argv[i + 1]); includes.push_back(tmp); i++; } else if (result = (cmd == "-D")) { // -D izanagi::tool::CString tmp; tmp.format("%s", argv[i + 1]); defines.push_back(tmp); i++; } else if (result = (cmd == "-obj")) { // -obj objDir.format("%s", argv[i + 1]); i++; } else if (result = (cmd == "-src")) { // -src shader.format("%s", argv[i + 1]); i++; } else if (result = (cmd == "-o")) { // -o outFile.format("%s", argv[i + 1]); i++; } else if (result = (cmd == "-E")) { // -E shader.format("%s", argv[i + 1]); i++; isPreproc = TRUE; } else if (result = (cmd == "-l")) { // -l optionFile.format("%s", argv[i + 1]); i++; } } if (!result) { // 引数無しオプション if (result = (cmd == "-asm")) { // -asm isCompileAsm = TRUE; } } if (!result) { // TODO printf("無効なオプションです[%s]\n\n", cmd); //IZ_ASSERT(FALSE); return FALSE; } } if (optionFile.empty()) { // 設定ファイルが指定されていない if (!AnalysisInternal()) { return FALSE; } } else { std::vector<izanagi::tool::CString> tvArgsList; // 設定ファイル解析 if (AnalysisOptionFile(tvArgsList)) { if (!tvArgsList.empty()) { // うーん・・・ std::vector<char*> args_tmp; { // 最初にはダミーを入れる args_tmp.push_back(""); std::vector<izanagi::tool::CString>::iterator it = tvArgsList.begin(); while (it != tvArgsList.end()) { const char* p = *it; args_tmp.push_back(const_cast<char*>(p)); it++; } } // 再度解析 if (!Analysis((int)args_tmp.size(), &args_tmp[0])) { IZ_ASSERT(FALSE); // TODO return FALSE; } } else { // 設定ファイルが空て・・・ IZ_ASSERT(FALSE); // TODO return FALSE; } } } return TRUE; }
int main(int argc, char *argv[]){ int p_order = 2; int n_threads = 0; TPZGeoMesh * gmesh = ReadGeometry(); #ifdef PZDEBUG PrintGeometry(gmesh); #endif TPZCompMesh *cmesh = CMeshFooting2D(gmesh, p_order); TPZAnalysis *analysis = Analysis(cmesh,n_threads); #ifdef USING_BOOST boost::posix_time::ptime post_proc_t1 = boost::posix_time::microsec_clock::local_time(); #endif /// Creation of a post-process analysis TPZPostProcAnalysis * post_processor = new TPZPostProcAnalysis; post_processor->SetCompMesh(cmesh); int n_regions = 1; TPZManVector<int,10> post_mat_id(n_regions); post_mat_id[0] = ERock; TPZStack<std::string> scalar_names,vector_names, tensor_names; vector_names.Push("Displacement"); tensor_names.Push("Strain"); tensor_names.Push("StrainPlastic"); tensor_names.Push("Stress"); TPZStack<std::string> var_names; for (auto i : scalar_names) { var_names.Push(i); } for (auto i : vector_names) { var_names.Push(i); } for (auto i : tensor_names) { var_names.Push(i); } post_processor->SetPostProcessVariables(post_mat_id, var_names); TPZFStructMatrix structmatrix(post_processor->Mesh()); structmatrix.SetNumThreads(n_threads); post_processor->SetStructuralMatrix(structmatrix); #ifdef USING_BOOST boost::posix_time::ptime post_proc_t2 = boost::posix_time::microsec_clock::local_time(); #endif #ifdef USING_BOOST REAL case_solving_time = boost::numeric_cast<double>((post_proc_t2-post_proc_t1).total_milliseconds()); std::cout << "Created post-processing in :" << setw(10) << case_solving_time/1000.0 << setw(5) << " seconds." << std::endl; std::cout << std::endl; #endif #ifdef USING_BOOST boost::posix_time::ptime case_t1 = boost::posix_time::microsec_clock::local_time(); #endif std::string plotfile = "footing_elast.vtk"; // For a single step REAL dt = 0.1; int n_steps = 10; for (int it = 1; it <= n_steps; it++) { REAL t = it*dt; LoadingRamp(t,cmesh); FindRoot(analysis); AcceptSolution(cmesh, analysis); #ifdef USING_BOOST boost::posix_time::ptime post_l2_projection_proc_t1 = boost::posix_time::microsec_clock::local_time(); #endif post_processor->TransferSolution(); #ifdef USING_BOOST boost::posix_time::ptime post_l2_projection_proc_t2 = boost::posix_time::microsec_clock::local_time(); REAL l2_projection_time = boost::numeric_cast<double>((post_l2_projection_proc_t2-post_l2_projection_proc_t1).total_milliseconds()); std::cout << "L2 projection post-processing in :" << setw(10) << l2_projection_time/1000.0 << setw(5) << " seconds." << std::endl; std::cout << std::endl; #endif #ifdef USING_BOOST boost::posix_time::ptime post_vtk_proc_t1 = boost::posix_time::microsec_clock::local_time(); #endif PostProcess(post_processor,scalar_names,vector_names,tensor_names,plotfile); #ifdef USING_BOOST boost::posix_time::ptime post_vtk_proc_t2 = boost::posix_time::microsec_clock::local_time(); REAL vtk_drawing_time = boost::numeric_cast<double>((post_vtk_proc_t2-post_vtk_proc_t1).total_milliseconds()); std::cout << "Drawing vtk file in :" << setw(10) << vtk_drawing_time/1000.0 << setw(5) << " seconds." << std::endl; std::cout << std::endl; #endif } #ifdef USING_BOOST boost::posix_time::ptime case_t2 = boost::posix_time::microsec_clock::local_time(); REAL case_time = boost::numeric_cast<double>((case_t2-case_t1).total_milliseconds()); std::cout << "Execution complete in :" << setw(10) << case_time/1000.0 << setw(5) << " seconds." << std::endl; std::cout << std::endl; #endif std::cout << "Execution complete." << std::endl; return 0; }
void KVINDRAOnlineDataAnalyser::ProcessRun() { // Perform treatment of a given run //Open data file fRunFile = (KVRawDataReader*)gDataSet->OpenRunfile(GetDataType().Data() , fRunNumber); if (fRunFile->GetStatus() == KVGRUNetClientGanilReader::kSTATUS_NOHOST) { // cannot connect to ACQ host Error("ProcessRun", "Cannot connect to acquisition host machine. Check KVGRUNetClientGanilReader.AcqHostName"); return; } //warning! real number of run may be different from that deduced from file name //we get the real run number from gMultiDetArray and use it to name any new files fRunNumber = gMultiDetArray->GetCurrentRunNumber(); fEventNumber = 0; //event number cout << endl << "Reading ONLINE events from RUN# " << fRunNumber << endl; cout << "Starting analysis of data on : "; TDatime now; cout << now.AsString() << endl << endl; preInitRun(); //call user's beginning of run InitRun(); postInitRun(); fDetEv = new KVDetectorEvent; //loop over events in file fGoEventLoop = kTRUE; fDumpEvents = kFALSE; while (fGoEventLoop) { Bool_t gotevent = fRunFile->GetNextEvent(); if (gotevent) { fEventNumber++; //reconstruct hit groups KVSeqCollection* fired = fRunFile->GetFiredDataParameters(); gMultiDetArray->GetDetectorEvent(fDetEv, fired); preAnalysis(); //call user's analysis. stop if returns kFALSE. if (!Analysis()) break; postAnalysis(); fDetEv->Clear(); if (!((fEventNumber) % 10000)) cout << " ++++ " << fEventNumber << " events read ++++ " << endl; } else { // got no event - why ? Int_t status = fRunFile->GetStatus(); switch (status) { case KVGRUNetClientGanilReader::kSTATUS_NOBUFF: Warning("ProcessRun", "Got no buffer from ACQHOST. Sleeping for 2 seconds."); gSystem->Sleep(2000); break; case KVGRUNetClientGanilReader::kSTATUS_NOEVENT: Warning("ProcessRun", "Got no event from ACQHOST. Sleeping for 2 seconds."); gSystem->Sleep(2000); break; case KVGRUNetClientGanilReader::kSTATUS_NOACQ: Warning("ProcessRun", "Acquisition is stopped. Sleeping for 5 seconds."); gSystem->Sleep(5000); break; } } } delete fDetEv; cout << "Ending analysis of run " << fRunNumber << " on : "; TDatime now2; cout << now2.AsString() << endl << endl; cout << endl << "Finished reading " << fEventNumber << " events" << endl << endl; preEndRun(); //call user's end of run function EndRun(); postEndRun(); if (fMessageThread) { fMessageThread->Kill(); TThread::Delete(fMessageThread); delete fMessageThread; fMessageThread = 0; } }