Working with progress in context of eval

From what I see here, I don’t know if it is possible to work with progress command in context of eval or fill block. When I was using Popcorn Fractal on a image with dimension of 8192x8192, and setting points to 96, I looked at the bottom of the gui screen with no indication of how far am I at in percentage. All I know that it is going to create 6B points and no way to know at where I am at.

So, my question is that how can I work with progress in context of eval or fill? It would be useful for fractal filters.

I guess you call rprogress and assign it to a variable.

I’d say this is possible, using the run() function of the math evaluator, as you can invoke any kind of ‘pipelined’ command with it.
Could you try something as:

eval "
  for (k = 0, k<100, ++k,
    run('progress ',k,' wait 20');
  );
"

I attempted that, I’m not sure why it ends with a infinite loop.

eval "
for(ix=0,ix<w,ix++,
 for(iy=0,iy<h,iy++,
  for(n=0,n<200,n++,
   run('progress ',(ix+iy*w+((n+1)/200))/(wh+1));
  );
 );
);
"

Just don’t call run() for every iteration of the loop. This is a quite ‘heavy’ function in the sense that it recreates a new instance of it’s own G’MIC interpreter and run a pipeline for it, definitely not something you want to do for every pixel and for every n in your example.
It’s probably better to have something as

!(iter%10000)?run('progress...');

where iter is some variable that goes from 0 to something.

That does work. Thank you so much.


@David_Tschumperle : You can’t have 2 runs? I have two runs on #@cli rep_trsa.

if($1<4,
 for(n=0,n<td,n++,
  xn=xnf(xc,yc);
  yn=ynf(xc,yc);
  xc=xn;
  yc=yn;
  nX=xn*cenf*.75;
  nY=yn*cenf*.75;
  FnX=nX>=0?nX:mw+nX;
  FnY=nY>=0?nY:mh+nY;
  if(!i(#-1,FnX,FnY),pixcount++;);
  i(#-1,FnX,FnY)+=1;
  if(!n%100000,run('progress ',100*(n/td)));
 );
,
 for(n=0,n<td,n++,
  xn=xnf_3d(xc,yc,zc);
  yn=ynf_3d(xc,yc,zc);
  zn=znf_3d(xc,yc,zc);
  xc=xn;
  yc=yn;
  zc=zn;
  nX=xn*cenf*1;
  nY=yn*cenf*1;
  FnX=nX>=0?nX:mw+nX;
  FnY=nY>=0?nY:mh+nY;
  if(!i(#-1,FnX,FnY),pixcount++;);
  i(#-1,FnX,FnY)+=1;
  if(!n%100000,run('progress ',100*(n/td)));
 );

The progress bar does not update.


EDIT: I fixed it, but I had to add parenthesis for whatever reason. Not sure why it doesn’t work without it in this case. Oh well.

Looks like a classic mistake to me, as !n%100000 is equivalent to (!n)%100000, which is definitely not the same as !(n%100000) (that is what you want here).

(!n) in your case will be either 1 (first iteration of n) or 0 (otherwise), and thus (!n)%100000 is almost always equal to 0.

@Reptorian Basically you have to double check the math when there is a potential for ambiguity. I usually have a foo : ready to test math snippets.