|
224 | 224 |
|
225 | 225 | my ($od_fline, $od_cline);
|
226 | 226 |
|
227 |
| -for (my $itercount = 0; $itercount < $niter; $itercount++) { |
228 |
| - my @inputs = ( |
229 |
| - $testcase, |
230 |
| - $spectral_line, |
231 |
| - pdl(0, 1, 0, 0), # paraxial |
232 |
| - pdl(4, 4, 3, 6), # spectral line - main trace in D light, marginal in C,F |
233 |
| - pdl($clear_aperture / 2), # ray height, threads so no need to repeat |
234 |
| - ); |
235 |
| - my ($od, $sa) = PDL::trace_line(@inputs); |
236 |
| - my $pdl_od_sa = pdl($od, $sa)->slice("(3)")->transpose; # slice as only last col is of interest |
237 |
| - @od_sa = @{ $pdl_od_sa->slice(",0:1")->unpdl }; |
238 |
| - ($od_cline, $od_fline) = @{ $pdl_od_sa->slice("(0),2:3")->unpdl }; |
239 |
| - $aberr_lspher = $od_sa[1][0] - $od_sa[0][0]; |
240 |
| - $aberr_osc = 1 - ($od_sa[1][0] * $od_sa[1][1]) / |
241 |
| - (sin($od_sa[0][1]) * $od_sa[0][0]); |
242 |
| - $aberr_lchrom = $od_fline - $od_cline; |
243 |
| - $max_lspher = sin($od_sa[0][1]); |
244 |
| - # D light |
245 |
| - $max_lspher = 0.0000926 / ($max_lspher * $max_lspher); |
246 |
| - $max_osc = 0.0025; |
247 |
| - $max_lchrom = $max_lspher; |
248 |
| -} |
| 227 | +my @inputs = ( |
| 228 | + $testcase, |
| 229 | + $spectral_line, |
| 230 | + pdl(0, 1, 0, 0)->dummy(-1, $niter), # paraxial |
| 231 | + pdl(4, 4, 3, 6)->dummy(-1, $niter), # spectral line - main trace in D light, marginal in C,F |
| 232 | + pdl($clear_aperture / 2), # ray height, threads so no need to repeat |
| 233 | +); |
| 234 | +# slice as only last col of dim 0 is of interest, and only last result=dim 2 |
| 235 | +my ($od, $sa) = map $_->slice('(-1),,(-1)'), PDL::trace_line(@inputs); |
| 236 | +my $pdl_od_sa = pdl($od, $sa)->transpose; |
| 237 | +@od_sa = @{ $pdl_od_sa->slice(",0:1")->unpdl }; |
| 238 | +($od_cline, $od_fline) = @{ $pdl_od_sa->slice("(0),2:3")->unpdl }; |
| 239 | +$aberr_lspher = $od_sa[1][0] - $od_sa[0][0]; |
| 240 | +$aberr_osc = 1 - ($od_sa[1][0] * $od_sa[1][1]) / |
| 241 | + (sin($od_sa[0][1]) * $od_sa[0][0]); |
| 242 | +$aberr_lchrom = $od_fline - $od_cline; |
| 243 | +$max_lspher = sin($od_sa[0][1]); |
| 244 | +# D light |
| 245 | +$max_lspher = 0.0000926 / ($max_lspher * $max_lspher); |
| 246 | +$max_osc = 0.0025; |
| 247 | +$max_lchrom = $max_lspher; |
249 | 248 |
|
250 | 249 | my $interval = tv_interval(\@t);
|
251 | 250 | print "Time taken: $interval\n";
|
|
0 commit comments