void extern_links::DumpRegionFitParamsH5 ( int region_ndx, int flow, reg_params &rp ) { if ( ( mPtrs->m_regional_param !=NULL ) & ( mPtrs->m_derived_param!=NULL ) ) { int iBlk = CurComputeBlock ( flow ); ///------------------------------------------------------------------------------------------------------------ /// regionalParams, per compute block ///------------------------------------------------------------------------------------------------------------ SpecificRegionParamDump ( rp, region_ndx, iBlk ); ///------------------------------------------------------------------------------------------------------------ /// regionalParamsExtra, per compute block ///------------------------------------------------------------------------------------------------------------ // This is allowed here because they are "derived" parmaeters associated with the FitParams and not individual data blocks // although I may regret this mPtrs->m_derived_param->At ( region_ndx, 0 ,iBlk ) = GetModifiedMidNucTime ( &rp.nuc_shape,TNUCINDEX,0 ); mPtrs->m_derived_param->At ( region_ndx, 1 ,iBlk ) = GetModifiedMidNucTime ( &rp.nuc_shape,ANUCINDEX,0 ); mPtrs->m_derived_param->At ( region_ndx, 2 ,iBlk ) = GetModifiedMidNucTime ( &rp.nuc_shape,CNUCINDEX,0 ); mPtrs->m_derived_param->At ( region_ndx, 3 ,iBlk ) = GetModifiedMidNucTime ( &rp.nuc_shape,GNUCINDEX,0 ); mPtrs->m_derived_param->At ( region_ndx, 4 ,iBlk ) = GetModifiedSigma ( &rp.nuc_shape,TNUCINDEX ); mPtrs->m_derived_param->At ( region_ndx, 5 ,iBlk ) = GetModifiedSigma ( &rp.nuc_shape,ANUCINDEX ); mPtrs->m_derived_param->At ( region_ndx, 6 ,iBlk ) = GetModifiedSigma ( &rp.nuc_shape,CNUCINDEX ); mPtrs->m_derived_param->At ( region_ndx, 7 ,iBlk ) = GetModifiedSigma ( &rp.nuc_shape,GNUCINDEX ); } }
void reg_params::DumpRegionParamsLine(FILE *my_fp,int my_row, int my_col, int flow_block_size) { // officially the wrong way to do this fprintf(my_fp,"%4d\t%4d\t", my_row,my_col); fprintf(my_fp,"%5.3f\t%5.3f\t%5.3f\t%5.3f\t",d[TNUCINDEX],d[ANUCINDEX],d[CNUCINDEX],d[GNUCINDEX]); fprintf(my_fp,"%5.3f\t%5.3f\t%5.3f\t%5.3f\t",krate[TNUCINDEX],krate[ANUCINDEX],krate[CNUCINDEX],krate[GNUCINDEX]); fprintf(my_fp,"%5.3f\t%5.3f\t%5.3f\t%5.3f\t",kmax[TNUCINDEX],kmax[ANUCINDEX],kmax[CNUCINDEX],kmax[GNUCINDEX]); fprintf(my_fp,"%5.3f\t",nuc_shape.AccessTMidNuc()[0]); fprintf(my_fp,"%5.3f\t%5.3f\t%5.3f\t%5.3f\t",GetModifiedMidNucTime(&nuc_shape,TNUCINDEX,0),GetModifiedMidNucTime(&nuc_shape,ANUCINDEX,0),GetModifiedMidNucTime(&nuc_shape,CNUCINDEX,0),GetModifiedMidNucTime(&nuc_shape,GNUCINDEX,0)); fprintf(my_fp,"%5.3f\t",nuc_shape.sigma); fprintf(my_fp,"%5.3f\t%5.3f\t%5.3f\t%5.3f\t",GetModifiedSigma(&nuc_shape,TNUCINDEX),GetModifiedSigma(&nuc_shape,ANUCINDEX),GetModifiedSigma(&nuc_shape,CNUCINDEX),GetModifiedSigma(&nuc_shape,GNUCINDEX)); fprintf(my_fp,"%5.3f\t%5.3f\t%5.3f\t%5.3f\t",NucModifyRatio[TNUCINDEX],NucModifyRatio[ANUCINDEX],NucModifyRatio[CNUCINDEX],NucModifyRatio[GNUCINDEX]); fprintf(my_fp,"%5.3f\t%5.3f\t%5.3f\t%5.3f\t%5.3f\t%5.3f\t",tau_R_m,tau_R_o,tauE,RatioDrift,CopyDrift,tshift); for (int i=0; i<flow_block_size; i++) fprintf(my_fp,"%5.3f\t",nuc_shape.t_mid_nuc_shift_per_flow[i]); fprintf(my_fp,"\n"); }
void DumpRegionParamsLine(FILE *my_fp,int my_row, int my_col, reg_params &rp) { // officially the wrong way to do this fprintf(my_fp,"%4d\t%4d\t", my_row,my_col); fprintf(my_fp,"%5.3f\t%5.3f\t%5.3f\t%5.3f\t",rp.d[TNUCINDEX],rp.d[ANUCINDEX],rp.d[CNUCINDEX],rp.d[GNUCINDEX]); fprintf(my_fp,"%5.3f\t%5.3f\t%5.3f\t%5.3f\t",rp.krate[TNUCINDEX],rp.krate[ANUCINDEX],rp.krate[CNUCINDEX],rp.krate[GNUCINDEX]); fprintf(my_fp,"%5.3f\t%5.3f\t%5.3f\t%5.3f\t",rp.kmax[TNUCINDEX],rp.kmax[ANUCINDEX],rp.kmax[CNUCINDEX],rp.kmax[GNUCINDEX]); fprintf(my_fp,"%5.3f\t",rp.nuc_shape.t_mid_nuc[0]); fprintf(my_fp,"%5.3f\t%5.3f\t%5.3f\t%5.3f\t",GetModifiedMidNucTime(&rp.nuc_shape,TNUCINDEX,0),GetModifiedMidNucTime(&rp.nuc_shape,ANUCINDEX,0),GetModifiedMidNucTime(&rp.nuc_shape,CNUCINDEX,0),GetModifiedMidNucTime(&rp.nuc_shape,GNUCINDEX,0)); fprintf(my_fp,"%5.3f\t",rp.nuc_shape.sigma); fprintf(my_fp,"%5.3f\t%5.3f\t%5.3f\t%5.3f\t",GetModifiedSigma(&rp.nuc_shape,TNUCINDEX),GetModifiedSigma(&rp.nuc_shape,ANUCINDEX),GetModifiedSigma(&rp.nuc_shape,CNUCINDEX),GetModifiedSigma(&rp.nuc_shape,GNUCINDEX)); fprintf(my_fp,"%5.3f\t%5.3f\t%5.3f\t%5.3f\t",rp.NucModifyRatio[TNUCINDEX],rp.NucModifyRatio[ANUCINDEX],rp.NucModifyRatio[CNUCINDEX],rp.NucModifyRatio[GNUCINDEX]); fprintf(my_fp,"%5.3f\t%5.3f\t%5.3f\t%5.3f\t%5.3f\t%5.3f\t",rp.tau_R_m,rp.tau_R_o,rp.tauE,rp.RatioDrift,rp.CopyDrift,rp.tshift); for (int i=0; i<NUMFB; i++) fprintf(my_fp,"%5.3f\t",rp.nuc_shape.t_mid_nuc_shift_per_flow[i]); fprintf(my_fp,"\n"); }
void BkgParamH5::DumpBkgModelRegionInfoH5(BkgFitterTracker &GlobalFitter, int flow, bool last_flow) // DumpBkgModelRegionInfoH5() called by IncrementalWrite() for every flow in ProcessImageToWell.cpp { int numRegions = GlobalFitter.numFitters; for (int r = 0; r<numRegions; r++) { ///------------------------------------------------------------------------------------------------------------ /// emptyTrace // use copyCube_element to copy DataCube element to mEmptyOnceParam in BkgParamH5::DumpBkgModelRegionInfoH5 ///------------------------------------------------------------------------------------------------------------ int imgFrames = GlobalFitter.BkgModelFitters[r]->get_emptytrace_imgFrames(); float *buff = GlobalFitter.BkgModelFitters[r]->get_emptytrace_bg_buffers(); float *bg_bead_dc = GlobalFitter.BkgModelFitters[r]->get_emptytrace_bg_dc_offset(); for (int j=0; j<imgFrames; j++) { ptrs.copyCube_element(ptrs.mEmptyOnceParam,r,j,flow,buff[j]); } ///------------------------------------------------------------------------------------------------------------ /// bg_bead_DC ///------------------------------------------------------------------------------------------------------------ ptrs.copyMatrix_element(ptrs.mBeadDC_bg,r,flow,bg_bead_dc[flow]); } if (CheckFlowForWrite(flow, last_flow) ) { struct reg_params rp; struct reg_params_H5 rp5; //int numParam = sizeof(reg_params)/sizeof(float); // +1 naot necessary int numParam = sizeof(reg_params_H5)/sizeof(float); // +1 not necessary //cout << "DumpBkgModelRegionInfoH5... numParam=" << numParam << ", sizeof(reg_params) " << sizeof(reg_params) << " / size(float)" << sizeof(float) << endl; for (int r = 0; r<numRegions; r++) { GlobalFitter.BkgModelFitters[r]->GetRegParams(rp); int iFlow1 = flow%NUMFB + 1; ///------------------------------------------------------------------------------------------------------------ /// darkMatter // use copyCube_element to copy DataCube element to mDarkOnceParam in BkgParamH5::DumpBkgModelRegionInfoH5 ///------------------------------------------------------------------------------------------------------------ int npts = GlobalFitter.BkgModelFitters[r]->get_tim_c_npts(); for (int i=0; i<NUMNUC; i++) { float * missingMass = GlobalFitter.BkgModelFitters[r]->get_region_darkMatter(i); for (int j=0; j<npts; j++) ptrs.copyCube_element(ptrs.mDarkOnceParam,r,i,j,missingMass[j]); for (int j=npts; j<MAX_COMPRESSED_FRAMES; j++) ptrs.copyCube_element(ptrs.mDarkOnceParam,r,i,j,0); // pad 0's } ///------------------------------------------------------------------------------------------------------------ /// darkness // use copyMatrix_element to copy Matrix element to mDarknessParam in BkgParamH5::DumpBkgModelRegionInfoH5 ///------------------------------------------------------------------------------------------------------------ for (int i=0; i<iFlow1; i++) ptrs.copyMatrix_element(ptrs.mDarknessParam,r,i,rp.darkness[i]); for (int i=iFlow1; i<NUMFB; i++) ptrs.copyMatrix_element(ptrs.mDarknessParam,r,i,0); //pad 0's ///------------------------------------------------------------------------------------------------------------ /// region_size, only once at flow+1=NUMFB ///------------------------------------------------------------------------------------------------------------ regionOffset.at(r,0) = GlobalFitter.BkgModelFitters[r]->get_region_row(); regionOffset.at(r,1) = GlobalFitter.BkgModelFitters[r]->get_region_col(); ///------------------------------------------------------------------------------------------------------------ /// regionInitParam, only once at flow+1=NUMFB ///------------------------------------------------------------------------------------------------------------ regionInitParam.at(r,0) = GlobalFitter.BkgModelFitters[r]->get_t_mid_nuc_start(); regionInitParam.at(r,1) = GlobalFitter.BkgModelFitters[r]->get_sigma_start(); ///------------------------------------------------------------------------------------------------------------ /// regionalParams, many times at each (flow+1)%NUMFB==0 ///------------------------------------------------------------------------------------------------------------ //float *rpp = (float *) &rp; float *rpp5 = (float *) &rp5; reg_params_copyTo_reg_params_H5(rp,rp5); for (int i = 0; i < numParam; i++) regionalParams.at(r, i) = rpp5[i]; ///------------------------------------------------------------------------------------------------------------ /// regionalParamsExtra, many times at each (flow+1)%NUMFB==0 ///------------------------------------------------------------------------------------------------------------ regionalParamsExtra.at(r, 0) = GetModifiedMidNucTime(&rp.nuc_shape,TNUCINDEX,0); regionalParamsExtra.at(r, 1) = GetModifiedMidNucTime(&rp.nuc_shape,ANUCINDEX,0); regionalParamsExtra.at(r, 2) = GetModifiedMidNucTime(&rp.nuc_shape,CNUCINDEX,0); regionalParamsExtra.at(r, 3) = GetModifiedMidNucTime(&rp.nuc_shape,GNUCINDEX,0); regionalParamsExtra.at(r, 4) = GetModifiedSigma(&rp.nuc_shape,TNUCINDEX); regionalParamsExtra.at(r, 5) = GetModifiedSigma(&rp.nuc_shape,ANUCINDEX); regionalParamsExtra.at(r, 6) = GetModifiedSigma(&rp.nuc_shape,CNUCINDEX); regionalParamsExtra.at(r, 7) = GetModifiedSigma(&rp.nuc_shape,GNUCINDEX); regionalParamsExtra.at(r, 8) = rp.nuc_shape.sigma; } ///------------------------------------------------------------------------------------------------------------ /// write to dataset (DS) in the .h5 output file ///------------------------------------------------------------------------------------------------------------ //note: regionParam only has to allocate enough regionalParam.n_rows per flow-block // only the DS has to have the right # of rows, as in the CreateDataSet() //cout << "DumpBkgModelRegionInfoH5... flow= " << flow << endl; size_t starts[2]; size_t ends[2]; //starts[0] = flow/NUMFB * numRegions; starts[0] = 0; ends[0] = starts[0] + numRegions; if (last_flow && (flow+1) % NUMFB != 0) { ends[0] = starts[0] + (flow+1) % NUMFB; //starts[0] = ceil((float) flow / NUMFB); cout << "DumpBkgModelRegionInfoH5... lastflow= " << flow << endl; cout << "changing starts[0] from " << (flow/NUMFB)* numRegions << " to " << starts[0] << " at flow " << flow << endl; } starts[1] = 0; ends[1] = regionalParams.n_cols; // numParam, not numParam+1 ION_ASSERT(ends[0] <= regionalParams.n_rows, "ends[0] > regionalParam.n_rows"); ION_ASSERT(ends[1] <= regionalParams.n_cols, "ends[1] > regionalParam.n_cols"); // write matrix to the DS w/ the right start/offset (or the right DS as in the later versions) int iBlk = ceil(float(flow+1)/NUMFB) - 1; arma::Mat<float> m = arma::trans(regionalParams); regionParamDS[iBlk]->WriteRangeData(starts, ends, m.memptr()); ends[1] = regionalParamsExtra.n_cols; arma::Mat<float> m1 = arma::trans(regionalParamsExtra); regionParamDSExtra[iBlk]->WriteRangeData(starts, ends, m1.memptr()); } }