30 int i(1), left(50), bottom(200), width(500), height(250), nm(1);
36 if ( !comp )
return -1;
39 for ( nm=0, mp =
model; mp; mp = mp->
next ) nm++;
46 *fps <<
"%%Page: " << i <<
" " << i << endl;
47 *fps <<
"/Helvetica findfont 12 scalefont setfont" << endl;
48 *fps <<
"50 755 moveto (" << title <<
": " <<
model->
id <<
") show" << endl;
49 *fps <<
"/Data [" << endl <<
"%x y fom sel" << endl;
51 for ( comp = mp->
comp; comp; comp = comp->
next )
if ( comp->
sel ) {
55 *fps << setprecision(4) << x <<
" " << y <<
" " << comp->
fom <<
" " << comp->
sel << endl;
58 *fps <<
"] def" << endl;
60 *fps <<
"showpage" << endl;
62 for ( i=1, mp =
model; mp; mp = mp->
next, i++ ) {
63 *fps <<
"%%Page: " << i <<
" " << i << endl;
64 *fps <<
"/Helvetica findfont 12 scalefont setfont" << endl;
65 *fps <<
"50 755 moveto (" << title <<
": " << mp->
id <<
") show" << endl;
66 *fps <<
"/Data [" << endl <<
"%x y fom sel" << endl;
67 for ( comp = mp->
comp; comp; comp = comp->
next )
if ( comp->
sel ) {
71 *fps << setprecision(4) << x <<
" " << y <<
" " << comp->
fom <<
" " << comp->
sel << endl;
73 *fps <<
"] def" << endl;
75 *fps <<
"showpage" << endl;
100 for ( nm=0, mp =
model; mp; mp = mp->
next ) nm++;
109 *fps <<
"%%Page: " << i <<
" " << i << endl;
110 *fps <<
"/Helvetica findfont 12 scalefont setfont" << endl;
111 *fps <<
"50 755 moveto (" << title <<
": " <<
model->
id <<
") show" << endl;
112 *fps <<
"/Data [" << endl <<
"%x y fom sel" << endl;
114 ps_views(fps, symmetry_string, view, 2);
116 *fps <<
"showpage" << endl;
118 for ( i=1, mp =
model; mp; mp = mp->
next, i++ ) {
119 *fps <<
"%%Page: " << i <<
" " << i << endl;
120 *fps <<
"/Helvetica findfont 12 scalefont setfont" << endl;
121 *fps <<
"50 755 moveto (" << title <<
": " << mp->
id <<
") show" << endl;
122 *fps <<
"/Data [" << endl <<
"%x y fom sel" << endl;
124 ps_views(fps, symmetry_string, view, 2);
126 *fps <<
"showpage" << endl;
143 if ( !
model )
return 0;
145 int nmod, i, j, nh(100), max(0);
149 for ( nmod=0, mp =
model; mp; mp = mp->
next )
if ( mp->
sel ) nmod++;
153 cout <<
"Generating file " << filename <<
" with a FOM histogram" << endl << endl;
155 cout <<
"Generating file " << filename <<
" with " << nmod <<
" FOM histograms" << endl << endl;
158 Bstring title(
"FOM histogram");
162 for ( i=0; i<=nh; i++ ) (*plot)[i] = i*1.0/nh;
164 for ( j=0, mp =
model; mp; mp = mp->
next )
if ( mp->
sel ) {
166 for ( comp = mp->
comp; comp; comp = comp->
next )
if ( comp->
sel ) {
167 i = (long) (comp->
fom*nh + 0.5);
169 if ( i > nh ) i = nh;
175 if ( max < (*plot)[i] ) max = (
int) (*plot)[i];
176 max = 10*(max/10 + 1);
178 for ( i=0; i<nmod; i++ ) {
221 vector<double>& distrib, vector<double>& prob,
double R,
Bstring& filename)
223 if ( filename.
length() < 1 )
return -1;
234 long npoint(ncomp+1);
239 double hmin(1e6), hmax(-1e6);
241 Bstring title(
"Occupancy Analysis");
246 cout <<
"DEBUG ps_model_occupancy: first page " << endl;
251 title = filename +
": Occupancy";
264 for ( i=3; i<=nfunc; i++ ) {
285 txt =
Bstring(cutoff,
"Coverage cutoff: %g");
291 for ( i=0; i<nfit; i++ ) txt +=
Bstring(prob[i],
" %f");
293 txt =
"Probability: ";
294 for ( i=0; i<nfit; i++ ) txt +=
Bstring(prob[i+nfit],
" %f");
301 for ( i=0; i<npoint; i++) (*plot)[i] = i;
302 for ( i=0, j=npoint; i<npoint*nfunc; i++, j++ ) (*plot)[j] = distrib[i];
312 cout <<
"DEBUG ps_model_occupancy: second page " << endl;
314 for ( hmin=1e6, hmax=-1e6, mp =
model; mp; mp = mp->
next ) {
315 for ( comp = mp->
comp; comp; comp = comp->
next ) {
321 if ( hmin == hmax ) {
322 cerr <<
"Warning: The component densities vary only from " << hmin <<
" to " << hmax << endl;
326 scale = (bins - 1)/(hmax - hmin);
328 plot =
new Bplot(1, bins, 2);
330 title = filename +
": Average density";
343 cout <<
"DEBUG ps_model_occupancy: bins=" << bins <<
" scale=" << scale << endl;
346 for ( comp = mp->
comp; comp; comp = comp->
next ) {
347 i = (long) (scale*(comp->
density - hmin) + 0.5);
348 if ( i < bins ) (*plot)[i+bins] += 1;
352 for ( i=0, j=bins, y_max = 0; i<bins; i++, j++ ) {
353 (*plot)[i] = i/scale + hmin;
354 if ( y_max < (*plot)[j] ) y_max = (*plot)[j];
371 cout <<
"DEBUG ps_model_occupancy: third page " << endl;
373 for ( hmin=1e6, hmax=-1e6, mp =
model; mp; mp = mp->
next ) {
374 for ( comp = mp->
comp; comp; comp = comp->
next, i++ ) {
376 if ( shift > hmax ) hmax = shift;
377 if ( shift < hmin ) hmin = shift;
381 scale = (bins - 1)/(hmax - hmin);
383 plot =
new Bplot(1, bins, 2);
385 title = filename +
": Shifts";
398 for ( comp = mp->
comp; comp; comp = comp->
next ) {
401 i = (long) (scale*(shift - hmin) + 0.5);
402 if ( i < bins ) (*plot)[i+bins] += 1;
407 for ( i=0, j=bins, y_max = 0; i<bins; i++, j++ ) {
408 (*plot)[i] = i/scale + hmin;
409 if ( y_max < (*plot)[j] ) y_max = (*plot)[j];