Diff of the two buildlogs: -- --- b1/build.log 2024-11-15 18:57:47.506465830 +0000 +++ b2/build.log 2024-11-15 19:03:24.111170930 +0000 @@ -1,6 +1,6 @@ I: pbuilder: network access will be disabled during build -I: Current time: Fri Nov 15 06:52:12 -12 2024 -I: pbuilder-time-stamp: 1731696732 +I: Current time: Fri Dec 19 15:20:50 +14 2025 +I: pbuilder-time-stamp: 1766107250 I: Building the build Environment I: extracting base tarball [/var/cache/pbuilder/trixie-reproducible-base.tgz] I: copying local configuration @@ -26,51 +26,83 @@ dpkg-source: info: unpacking octave-optics_0.1.4-4.debian.tar.xz I: Not using root during the build. I: Installing the build-deps -I: user script /srv/workspace/pbuilder/4139765/tmp/hooks/D02_print_environment starting +I: user script /srv/workspace/pbuilder/1104808/tmp/hooks/D01_modify_environment starting +debug: Running on infom02-amd64. +I: Changing host+domainname to test build reproducibility +I: Adding a custom variable just for the fun of it... +I: Changing /bin/sh to bash +'/bin/sh' -> '/bin/bash' +lrwxrwxrwx 1 root root 9 Dec 19 01:21 /bin/sh -> /bin/bash +I: Setting pbuilder2's login shell to /bin/bash +I: Setting pbuilder2's GECOS to second user,second room,second work-phone,second home-phone,second other +I: user script /srv/workspace/pbuilder/1104808/tmp/hooks/D01_modify_environment finished +I: user script /srv/workspace/pbuilder/1104808/tmp/hooks/D02_print_environment starting I: set - BUILDDIR='/build/reproducible-path' - BUILDUSERGECOS='first user,first room,first work-phone,first home-phone,first other' - BUILDUSERNAME='pbuilder1' - BUILD_ARCH='amd64' - DEBIAN_FRONTEND='noninteractive' + BASH=/bin/sh + BASHOPTS=checkwinsize:cmdhist:complete_fullquote:extquote:force_fignore:globasciiranges:globskipdots:hostcomplete:interactive_comments:patsub_replacement:progcomp:promptvars:sourcepath + BASH_ALIASES=() + BASH_ARGC=() + BASH_ARGV=() + BASH_CMDS=() + BASH_LINENO=([0]="12" [1]="0") + BASH_LOADABLES_PATH=/usr/local/lib/bash:/usr/lib/bash:/opt/local/lib/bash:/usr/pkg/lib/bash:/opt/pkg/lib/bash:. + BASH_SOURCE=([0]="/tmp/hooks/D02_print_environment" [1]="/tmp/hooks/D02_print_environment") + BASH_VERSINFO=([0]="5" [1]="2" [2]="32" [3]="1" [4]="release" [5]="x86_64-pc-linux-gnu") + BASH_VERSION='5.2.32(1)-release' + BUILDDIR=/build/reproducible-path + BUILDUSERGECOS='second user,second room,second work-phone,second home-phone,second other' + BUILDUSERNAME=pbuilder2 + BUILD_ARCH=amd64 + DEBIAN_FRONTEND=noninteractive DEB_BUILD_OPTIONS='buildinfo=+all reproducible=+all parallel=12 ' - DISTRIBUTION='trixie' - HOME='/root' - HOST_ARCH='amd64' + DIRSTACK=() + DISTRIBUTION=trixie + EUID=0 + FUNCNAME=([0]="Echo" [1]="main") + GROUPS=() + HOME=/root + HOSTNAME=i-capture-the-hostname + HOSTTYPE=x86_64 + HOST_ARCH=amd64 IFS=' ' - INVOCATION_ID='e10064558533440eb5595cb0e32a548c' - LANG='C' - LANGUAGE='en_US:en' - LC_ALL='C' - MAIL='/var/mail/root' - OPTIND='1' - PATH='/usr/sbin:/usr/bin:/sbin:/bin:/usr/games' - PBCURRENTCOMMANDLINEOPERATION='build' - PBUILDER_OPERATION='build' - PBUILDER_PKGDATADIR='/usr/share/pbuilder' - PBUILDER_PKGLIBDIR='/usr/lib/pbuilder' - PBUILDER_SYSCONFDIR='/etc' - PPID='4139765' - PS1='# ' - PS2='> ' + INVOCATION_ID=93eef2526c8e4f588d0ba3725a9f9ad4 + LANG=C + LANGUAGE=et_EE:et + LC_ALL=C + MACHTYPE=x86_64-pc-linux-gnu + MAIL=/var/mail/root + OPTERR=1 + OPTIND=1 + OSTYPE=linux-gnu + PATH=/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/i/capture/the/path + PBCURRENTCOMMANDLINEOPERATION=build + PBUILDER_OPERATION=build + PBUILDER_PKGDATADIR=/usr/share/pbuilder + PBUILDER_PKGLIBDIR=/usr/lib/pbuilder + PBUILDER_SYSCONFDIR=/etc + PIPESTATUS=([0]="0") + POSIXLY_CORRECT=y + PPID=1104808 PS4='+ ' - PWD='/' - SHELL='/bin/bash' - SHLVL='2' - SUDO_COMMAND='/usr/bin/timeout -k 18.1h 18h /usr/bin/ionice -c 3 /usr/bin/nice /usr/sbin/pbuilder --build --configfile /srv/reproducible-results/rbuild-debian/r-b-build.otSMe1V0/pbuilderrc_GBIo --distribution trixie --hookdir /etc/pbuilder/first-build-hooks --debbuildopts -b --basetgz /var/cache/pbuilder/trixie-reproducible-base.tgz --buildresult /srv/reproducible-results/rbuild-debian/r-b-build.otSMe1V0/b1 --logfile b1/build.log octave-optics_0.1.4-4.dsc' - SUDO_GID='109' - SUDO_UID='104' - SUDO_USER='jenkins' - TERM='unknown' - TZ='/usr/share/zoneinfo/Etc/GMT+12' - USER='root' - _='/usr/bin/systemd-run' + PWD=/ + SHELL=/bin/bash + SHELLOPTS=braceexpand:errexit:hashall:interactive-comments:posix + SHLVL=3 + SUDO_COMMAND='/usr/bin/timeout -k 24.1h 24h /usr/bin/ionice -c 3 /usr/bin/nice -n 11 /usr/bin/unshare --uts -- /usr/sbin/pbuilder --build --configfile /srv/reproducible-results/rbuild-debian/r-b-build.otSMe1V0/pbuilderrc_rkpv --distribution trixie --hookdir /etc/pbuilder/rebuild-hooks --debbuildopts -b --basetgz /var/cache/pbuilder/trixie-reproducible-base.tgz --buildresult /srv/reproducible-results/rbuild-debian/r-b-build.otSMe1V0/b2 --logfile b2/build.log octave-optics_0.1.4-4.dsc' + SUDO_GID=109 + SUDO_UID=104 + SUDO_USER=jenkins + TERM=unknown + TZ=/usr/share/zoneinfo/Etc/GMT-14 + UID=0 + USER=root + _='I: set' I: uname -a - Linux infom01-amd64 6.1.0-27-cloud-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.115-1 (2024-11-01) x86_64 GNU/Linux + Linux i-capture-the-hostname 6.10.11+bpo-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.10.11-1~bpo12+1 (2024-10-03) x86_64 GNU/Linux I: ls -l /bin - lrwxrwxrwx 1 root root 7 Aug 4 21:30 /bin -> usr/bin -I: user script /srv/workspace/pbuilder/4139765/tmp/hooks/D02_print_environment finished + lrwxrwxrwx 1 root root 7 Aug 4 2024 /bin -> usr/bin +I: user script /srv/workspace/pbuilder/1104808/tmp/hooks/D02_print_environment finished -> Attempting to satisfy build-dependencies -> Creating pbuilder-satisfydepends-dummy package Package: pbuilder-satisfydepends-dummy @@ -678,7 +710,7 @@ Get: 562 http://deb.debian.org/debian trixie/main amd64 texlive-latex-recommended all 2024.20241102-1 [8757 kB] Get: 563 http://deb.debian.org/debian trixie/main amd64 texlive-pictures all 2024.20241102-1 [17.0 MB] Get: 564 http://deb.debian.org/debian trixie/main amd64 texlive-latex-extra all 2024.20241102-1 [24.6 MB] -Fetched 308 MB in 5s (57.9 MB/s) +Fetched 308 MB in 6s (48.8 MB/s) debconf: delaying package configuration, since apt-utils is not installed Selecting previously unselected package libpython3.12-minimal:amd64. (Reading database ... (Reading database ... 5% (Reading database ... 10% (Reading database ... 15% (Reading database ... 20% (Reading database ... 25% (Reading database ... 30% (Reading database ... 35% (Reading database ... 40% (Reading database ... 45% (Reading database ... 50% (Reading database ... 55% (Reading database ... 60% (Reading database ... 65% (Reading database ... 70% (Reading database ... 75% (Reading database ... 80% (Reading database ... 85% (Reading database ... 90% (Reading database ... 95% (Reading database ... 100% (Reading database ... 19970 files and directories currently installed.) @@ -2519,8 +2551,8 @@ Setting up tzdata (2024b-3) ... Current default time zone: 'Etc/UTC' -Local time is now: Fri Nov 15 18:55:13 UTC 2024. -Universal Time is now: Fri Nov 15 18:55:13 UTC 2024. +Local time is now: Fri Dec 19 01:24:15 UTC 2025. +Universal Time is now: Fri Dec 19 01:24:15 UTC 2025. Run 'dpkg-reconfigure tzdata' if you wish to change it. Setting up libxcb-present0:amd64 (1.17.0-2+b1) ... @@ -3013,7 +3045,11 @@ Building tag database... -> Finished parsing the build-deps I: Building the package -I: Running cd /build/reproducible-path/octave-optics-0.1.4/ && env PATH="/usr/sbin:/usr/bin:/sbin:/bin:/usr/games" HOME="/nonexistent/first-build" dpkg-buildpackage -us -uc -b && env PATH="/usr/sbin:/usr/bin:/sbin:/bin:/usr/games" HOME="/nonexistent/first-build" dpkg-genchanges -S > ../octave-optics_0.1.4-4_source.changes +I: user script /srv/workspace/pbuilder/1104808/tmp/hooks/A99_set_merged_usr starting +Not re-configuring usrmerge for trixie +I: user script /srv/workspace/pbuilder/1104808/tmp/hooks/A99_set_merged_usr finished +hostname: Name or service not known +I: Running cd /build/reproducible-path/octave-optics-0.1.4/ && env PATH="/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/i/capture/the/path" HOME="/nonexistent/second-build" dpkg-buildpackage -us -uc -b && env PATH="/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/i/capture/the/path" HOME="/nonexistent/second-build" dpkg-genchanges -S > ../octave-optics_0.1.4-4_source.changes dpkg-buildpackage: info: source package octave-optics dpkg-buildpackage: info: source version 0.1.4-4 dpkg-buildpackage: info: source distribution unstable @@ -3882,21 +3918,75 @@ Checking package... Run the unit tests... Checking m files ... -[inst/jones_lphorizontal.m] ->>>>> /build/reproducible-path/octave-optics-0.1.4/inst/jones_lphorizontal.m +[inst/stokes_isstokes.m] +>>>>> /build/reproducible-path/octave-optics-0.1.4/inst/stokes_isstokes.m +***** test + % test type check + V1 = stokes_unpolarized(); + V2 = char(V1); + t1 = stokes_isstokes(V1); + t2 = stokes_isstokes(V2); + assert(t1 && ~t2); + +***** test + % test size check + V1 = stokes_unpolarized(); + V2 = V1; + V2(5,1) = 1; + t1 = stokes_isstokes(V1); + t2 = stokes_isstokes(V2); + assert(t1 && ~t2); + +***** test + % test size of return value + V1 = stokes_unpolarized(ones(2,3,4)); + V1{2,2,2} = 0; + V2 = stokes_unpolarized(ones(4,3,2)); + V2{1,1,1} = 0; + t1 = stokes_isstokes(V1); + t2 = stokes_isstokes(V2); + assert((size(t1)==size(V1)) && (size(t2)==size(V2))); + +***** test + % test size of return value + V1 = stokes_unpolarized(ones(2,3,4)); + V2 = stokes_unpolarized(1); + [t1,t2] = stokes_isstokes(V1,V2); + assert((size(t1)==size(V1)) && (size(t2)==[1,1])); + +***** test + % test indivial elements of return value + V1 = stokes_unpolarized(ones(2,3,4)); + V1{2,2,2} = 0; + V2 = stokes_unpolarized(ones(4,3,2)); + V2{1,1,1} = 0; + t1 = stokes_isstokes(V1); + t2 = stokes_isstokes(V2); + assert(t1(1,1,1) && ~t1(2,2,2) && ~t2(1,1,1) && t2(2,2,2)); +5 tests, 5 passed, 0 known failure, 0 skipped +[inst/jones_waveplate.m] +>>>>> /build/reproducible-path/octave-optics-0.1.4/inst/jones_waveplate.m ***** test % test default return value - V = jones_lphorizontal(); - R = V-[1;0]; + A = jones_waveplate(); + R = A*A-A; assert(norm(R,inf), 0, 1e-9); - ***** test - % test return value - amplitude = rand(1, 1); - V = jones_lphorizontal(amplitude); - R = V-[1;0]*amplitude; + % test serial application of absorptive elements + delay = rand(1, 1); + A1 = jones_waveplate(delay); + A2 = jones_waveplate(delay*2); + R = A1*A1-A2; + assert(norm(R,inf), 0, 1e-9); +***** test + % another test of serial application of absorptive elements + delay1 = rand(1, 1); + delay2 = rand(1, 1); + A1 = jones_waveplate(delay1); + A2 = jones_waveplate(delay2); + A12 = jones_waveplate(delay1+delay2); + R = A1*A2-A12; assert(norm(R,inf), 0, 1e-9); - ***** test % test correct size of return values for dim = 1:5 @@ -3906,28 +3996,100 @@ R = {R}; end rsize = size(R); - C = jones_lphorizontal(R); + C = jones_waveplate(R); csize = size(C); - assert(rsize == csize); + assert(csize, rsize); + end +4 tests, 4 passed, 0 known failure, 0 skipped +[inst/mueller_mirror.m] +>>>>> /build/reproducible-path/octave-optics-0.1.4/inst/mueller_mirror.m +***** test + % test mirror that is its own inverted element + A = mueller_mirror(); + R = (A-1\A); + assert(norm(R,inf), 0, 1e-9); + +***** test + % test direct size parameter + for dim = 1:5 + asize = randi([1 4], 1, dim); + rsize = size(rand(asize)); + U = mueller_mirror(rsize); + usize = size(U); + assert(usize == rsize); + end + +***** test + % test indirect size parameter + for dim = 1:5 + asize = randi([1 4], 1, dim); + C = cell(asize); + csize = size(C); + U = mueller_mirror(C); + usize = size(U); + assert(usize == csize); end + 3 tests, 3 passed, 0 known failure, 0 skipped -[inst/jones_lpplus45.m] ->>>>> /build/reproducible-path/octave-optics-0.1.4/inst/jones_lpplus45.m +[inst/jones_rotate.m] +>>>>> /build/reproducible-path/octave-optics-0.1.4/inst/jones_rotate.m ***** test - % test default return value - V = jones_lpplus45(); - R = V-[1;1]; + % default return value: unity matrix + A = jones_rotate(); + R = A*A-A; assert(norm(R,inf), 0, 1e-9); ***** test - % test return value - amplitude = rand(1, 1); - V = jones_lpplus45(amplitude); - R = V-[1;1]*amplitude; + % rotation by 0 should do nothing + delay = rand(1,1); + JM = jones_linretarder(delay); + A = jones_rotate(JM, 0); + R = JM-A; assert(norm(R,inf), 0, 1e-9); ***** test - % test correct size of return values + % undo rotation by 2nd opposite rotation + delay = rand(1,1); + angle = rand(1, 1); + JM = jones_linretarder(delay); + A1 = jones_rotate(JM, angle); + A2 = jones_rotate(A1, -angle); + R = A2-JM; + assert(norm(R,inf), 0, 1e-9); + +***** test + % test serial application of rotation + delay = rand(1,1); + angle1 = rand(1, 1); + angle2 = rand(1, 1); + JM = jones_linretarder(delay); + A1 = jones_rotate(JM, angle1); + A2 = jones_rotate(A1, angle2); + A12 = jones_rotate(JM, angle1+angle2); + R = A2-A12; + assert(norm(R,inf), 0, 1e-9); + +***** test + % testing MODE parameter + angle = rand(1, 1); + A1 = jones_rotate(jones_waveplate(0.5), angle, 'rad'); + A2 = jones_rotate(jones_waveplate(0.5), angle*180/pi(), 'deg'); + R = A2-A1; + assert(norm(R,inf), 0, 1e-9); + +***** test + % size of return value determined by 1st argument + angle = rand(1,1); + for dim = 1:5 + asize = randi([1 4], 1, dim); + rsize = size(rand(asize)); + C = jones_rotate(jones_unity(rsize), angle); + csize = size(C); + assert(rsize == csize); + end + +***** test + % size if return value determined by 2nd argument for dim = 1:5 asize = randi([1 4], 1, dim); R = rand(asize); @@ -3935,85 +4097,163 @@ R = {R}; end rsize = size(R); - C = jones_lpplus45(R); + C = jones_rotate(jones_unity(), R); csize = size(C); assert(rsize == csize); end -3 tests, 3 passed, 0 known failure, 0 skipped -[inst/mueller_checkmueller.m] ->>>>> /build/reproducible-path/octave-optics-0.1.4/inst/mueller_checkmueller.m -***** test - % test type check - A1 = mueller_unity(); - A2 = char(A1); - t1 = mueller_checkmueller(A1); - t2 = mueller_checkmueller(A2); - assert(t1 && ~t2); ***** test - % test size check - A1 = mueller_unity(); - A2 = A1; - A2(5,5) = 1; - t1 = mueller_checkmueller(A1); - t2 = mueller_checkmueller(A2); - assert(t1 && ~t2); + % size if return value determined by both argument + JM = jones_unity([4,3,2]); + angle = rand(2,3,4); + C = jones_rotate(JM, angle); + csize = size(C); + assert(csize == [4,3,4]); +8 tests, 8 passed, 0 known failure, 0 skipped +[inst/zernike_name.m] +>>>>> /build/reproducible-path/octave-optics-0.1.4/inst/zernike_name.m +***** assert (zernike_name (4), "defocus") +***** assert (zernike_name (22), "-") +***** error (zernike_name (0)) +***** error (zernike_name ([1 2])) +***** error (zernike_name (pi)) +5 tests, 5 passed, 0 known failure, 0 skipped +[inst/stokes_intensity.m] +>>>>> /build/reproducible-path/octave-optics-0.1.4/inst/stokes_intensity.m ***** test - % test size of return value - A1 = mueller_mirror([2,3,4]); - A1{2,2,2} = 0; - A2 = mueller_mirror([4,3,2]); - A2{1,1,1} = 0; - t1 = mueller_checkmueller(A1); - t2 = mueller_checkmueller(A2); - assert((size(A1)==size(t1)) && (size(A2)==size(t2))); + % test size and value of return values + r1 = rand(2,3,4); + V1 = stokes_unpolarized(r1); + r2 = rand(4,3,2); + V2 = stokes_unpolarized(r2); + i1 = stokes_intensity(V1); + i2 = stokes_intensity(V2); + assert(all(i1==r1) && all(i2==r2)); ***** test - % test indivial elements of return value - A1 = mueller_mirror([2,3,4]); - A1{2,2,2} = ones(4,4)*0.99; - A2 = mueller_mirror([4,3,2]); - A2{1,1,1} = ones(4,4)*1.01; - t1 = mueller_checkmueller(A1); - t2 = mueller_checkmueller(A2); - assert(t1(1,1,1) && ~t1(2,2,2) && ~t2(1,1,1) && t2(2,2,2)); + % test size and value of return values + r1 = rand(2,3,4); + V1 = stokes_unpolarized(r1); + r2 = rand(1,1); + V2 = stokes_unpolarized(r2); + [i1,i2] = stokes_intensity(V1,V2); + assert(all(i1==r1) && all(i2==r2)); +2 tests, 2 passed, 0 known failure, 0 skipped +[inst/zernike_cartesian.m] +>>>>> /build/reproducible-path/octave-optics-0.1.4/inst/zernike_cartesian.m +***** demo + t = linspace (-1, 1, 80); + [x, y] = meshgrid (t, t); + max_order = 16; + Z = zernike_cartesian (x, y, max_order); + for k = 1:max_order + subplot (4, 4, k) + factors = zeros (max_order, 1); + factors(k) = 1; + z = reshape (Z*factors, size (x)); + imagesc (z) + axis ("off", "equal") + zname = strrep (zernike_name (k), " ", "\n"); + title (zname) + endfor +***** demo + n=30; + [x,y,z] = sombrero (n); + z += 0.05 * peaks (x./4, y./4); + z += 0.02 * x; + figure + surf (x, y, z) + title ("Original sombrero + peaks + tilt"); + + ## approximate sombrero+peaks + d = 10; + x /= d; + y /= d; + max_order = 50; + Z = zernike_cartesian (x, y, max_order, false); + f = Z\z(:); + ## create approximated plot + z_approx = reshape (Z * f, n, n); + figure + surf (10 * x, 10 * y, z_approx) + title ("approximated"); +***** assert (zernike_cartesian (0, 0, 1), 1) +***** error (zernike_cartesian (0, 0, 0)) +***** error (zernike_cartesian (0, 0, pi)) +***** error (zernike_cartesian ()) 4 tests, 4 passed, 0 known failure, 0 skipped -[inst/zernike_R_poly.m] ->>>>> /build/reproducible-path/octave-optics-0.1.4/inst/zernike_R_poly.m -***** assert (zernike_R_poly (0, 0), [1]) -***** assert (zernike_R_poly (1, 1), [1 0]) -***** assert (zernike_R_poly (0, 2), [2 0 -1]) -***** assert (zernike_R_poly (2, 2), [1 0 0]) -***** assert (zernike_R_poly (1, 3), [3 0 -2 0]) -***** assert (zernike_R_poly (3, 3), [1 0 0 0]) -***** assert (zernike_R_poly (0, 4), [6 0 -6 0 1]) -***** assert (zernike_R_poly (2, 4), [4 0 -3 0 0]) -***** assert (zernike_R_poly (4, 4), [1 0 0 0 0]) -***** assert (zernike_R_poly (1, 5), [10 0 -12 0 3 0]) -***** assert (zernike_R_poly (3, 5), [5 0 -4 0 0 0]) -***** assert (zernike_R_poly (5, 5), [1 0 0 0 0 0]) -***** assert (zernike_R_poly (0, 6), [20 0 -30 0 12 0 -1]) -***** assert (zernike_R_poly (2, 6), [15 0 -20 0 6 0 0]) -***** assert (zernike_R_poly (4, 6), [ 6 0 -5 0 0 0 0]) -***** assert (zernike_R_poly (6, 6), [ 1 0 0 0 0 0 0]) -16 tests, 16 passed, 0 known failure, 0 skipped -[inst/jones_lpminus45.m] ->>>>> /build/reproducible-path/octave-optics-0.1.4/inst/jones_lpminus45.m +[inst/stokes_degpolarization.m] +>>>>> /build/reproducible-path/octave-optics-0.1.4/inst/stokes_degpolarization.m +***** test + % test size of return values + r1 = rand(2,3,4); + V1 = stokes_unpolarized(r1); + r2 = rand(4,3,2); + V2 = stokes_unpolarized(r2); + [d1,d2] = stokes_degpolarization(V1,V2); + assert((size(d1)==size(r1)) && size(size(d2)==size(r2))); + +***** test + % test return values + r1 = rand(1,1); + V1 = stokes_cpleft(r1)+stokes_unpolarized(1-r1); + r2 = rand(1,1); + V2 = stokes_unpolarized(r2); + [d1,d2] = stokes_degpolarization(V1,V2); + assert((d1==r1) && (d2==0)); +2 tests, 2 passed, 0 known failure, 0 skipped +[inst/mueller_circdiattenuator.m] +>>>>> /build/reproducible-path/octave-optics-0.1.4/inst/mueller_circdiattenuator.m ***** test % test default return value - V = jones_lpminus45(); - R = V-[1;-1]; + A = mueller_circdiattenuator(); + R = A*A-A; assert(norm(R,inf), 0, 1e-9); ***** test - % test return value - amplitude = rand(1, 1); - V = jones_lpminus45(amplitude); - R = V-[1;-1]*amplitude; + % test equality of providing diattenuation or kx and ky + d = rand(1, 1); + kr = 1; + kl = (1-d)./(1+d); + A1 = mueller_circdiattenuator(d); + A2 = mueller_circdiattenuator(kr, kl); + R = A1-A2; + assert(norm(R,inf), 0, 1e-9); + +***** test + % test serial application of circular diattenuators + kr = rand(1, 1); + kl = rand(1, 1); + A1 = mueller_circdiattenuator(kr,kl); + A2 = mueller_circdiattenuator(kr*kr,kl*kl); + R = A1*A1-A2; + assert(norm(R,inf), 0, 1e-9); + +***** test + % another test of serial application of retarder elements + kr1 = rand(1, 1); + kr2 = rand(1, 1); + kl1 = rand(1, 1); + kl2 = rand(1, 1); + A1 = mueller_circdiattenuator(kr1,kl1); + A2 = mueller_circdiattenuator(kr2,kl2); + A12 = mueller_circdiattenuator(kr1*kr2,kl1*kl2); + R = A1*A2-A12; assert(norm(R,inf), 0, 1e-9); ***** test + % test mode + kr = rand(1, 1); + kl = rand(1, 1); + A1 = mueller_circdiattenuator(kr,kl); + A2 = mueller_circdiattenuator(kr,kl,'int'); + A3 = mueller_circdiattenuator(sqrt(kr),sqrt(kl),'amp'); + R1 = A1-A2; + R2 = A1-A3; + assert(norm(R1,inf)+norm(R2,inf), 0, 1e-9); + +***** test % test correct size of return values for dim = 1:5 asize = randi([1 4], 1, dim); @@ -4022,38 +4262,82 @@ R = {R}; end rsize = size(R); - C = jones_lpminus45(R); + C = mueller_circdiattenuator(R); csize = size(C); assert(rsize == csize); end + +***** test + % another test correct size of return values + kr = rand(3,4,5); + kl = rand(5,4,3); + C = mueller_circdiattenuator(kr,kl); + csize = size(C); + assert(csize == [5,4,5]); +7 tests, 7 passed, 0 known failure, 0 skipped +[inst/mueller_unity.m] +>>>>> /build/reproducible-path/octave-optics-0.1.4/inst/mueller_unity.m +***** test + A = mueller_unity(); + R = A*A-A; + assert(norm(R,inf), 0, 1e-9); + +***** test + for dim = 1:5 + asize = randi([1 4], 1, dim); + C = cell(asize); + csize = size(C); + U = mueller_unity(C); + usize = size(U); + assert(usize == csize); + end + +***** test + for dim = 1:5 + asize = randi([1 4], 1, dim); + rsize = size(rand(asize)); + U = mueller_unity(rsize); + usize = size(U); + assert(usize == rsize); + end 3 tests, 3 passed, 0 known failure, 0 skipped -[inst/mueller_absorber.m] ->>>>> /build/reproducible-path/octave-optics-0.1.4/inst/mueller_absorber.m +[inst/mueller_linretarder.m] +>>>>> /build/reproducible-path/octave-optics-0.1.4/inst/mueller_linretarder.m ***** test % test default return value - A = mueller_absorber(); + A = mueller_linretarder(); R = A*A-A; assert(norm(R,inf), 0, 1e-9); ***** test - % test serial appliation of absorptive elements - absorption = rand(1, 1); - A1 = mueller_absorber(absorption); - A2 = mueller_absorber(1-(1-absorption)^2); + % test serial application of linear retarder elements + phase = rand(1, 1); + A1 = mueller_linretarder(phase); + A2 = mueller_linretarder(phase*2); R = A1*A1-A2; assert(norm(R,inf), 0, 1e-9); ***** test - % another test of serial appliation of absorptive elements - absorption1 = rand(1, 1); - absorption2 = rand(1, 1); - A1 = mueller_absorber(absorption1); - A2 = mueller_absorber(absorption2); - A12 = mueller_absorber(1-((1-absorption1)*(1-absorption2))); + % another test of serial application of retarder elements + phase1 = rand(1, 1); + phase2 = rand(1, 1); + A1 = mueller_linretarder(phase1); + A2 = mueller_linretarder(phase2); + A12 = mueller_linretarder(phase1+phase2); R = A1*A2-A12; assert(norm(R,inf), 0, 1e-9); ***** test + % test mode + phase = rand(1, 1); + A1 = mueller_linretarder(phase); + A2 = mueller_linretarder(phase*180/pi(), 'deg'); + A3 = mueller_linretarder(phase/(2*pi()), 'wav'); + R1 = A1-A2; + R2 = A1-A3; + assert(norm(R1,inf)+norm(R2,inf), 0, 1e-9); + +***** test % test correct size of return values for dim = 1:5 asize = randi([1 4], 1, dim); @@ -4062,24 +4346,24 @@ R = {R}; end rsize = size(R); - C = mueller_absorber(R); + C = mueller_linretarder(R); csize = size(C); assert(rsize == csize); end -4 tests, 4 passed, 0 known failure, 0 skipped -[inst/stokes_cpleft.m] ->>>>> /build/reproducible-path/octave-optics-0.1.4/inst/stokes_cpleft.m +5 tests, 5 passed, 0 known failure, 0 skipped +[inst/jones_lpplus45.m] +>>>>> /build/reproducible-path/octave-optics-0.1.4/inst/jones_lpplus45.m ***** test % test default return value - V = stokes_cpleft(); - R = V-[1;0;0;-1]; + V = jones_lpplus45(); + R = V-[1;1]; assert(norm(R,inf), 0, 1e-9); ***** test % test return value - intensity = rand(1, 1); - V = stokes_cpleft(intensity); - R = V-[1;0;0;-1]*intensity; + amplitude = rand(1, 1); + V = jones_lpplus45(amplitude); + R = V-[1;1]*amplitude; assert(norm(R,inf), 0, 1e-9); ***** test @@ -4091,88 +4375,156 @@ R = {R}; end rsize = size(R); - C = stokes_cpleft(R); + C = jones_lpplus45(R); csize = size(C); assert(rsize == csize); end 3 tests, 3 passed, 0 known failure, 0 skipped -[inst/stokes_intensity.m] ->>>>> /build/reproducible-path/octave-optics-0.1.4/inst/stokes_intensity.m +[inst/jones_unity.m] +>>>>> /build/reproducible-path/octave-optics-0.1.4/inst/jones_unity.m ***** test - % test size and value of return values - r1 = rand(2,3,4); - V1 = stokes_unpolarized(r1); - r2 = rand(4,3,2); - V2 = stokes_unpolarized(r2); - i1 = stokes_intensity(V1); - i2 = stokes_intensity(V2); - assert(all(i1==r1) && all(i2==r2)); + A = jones_unity(); + R = A*A-A; + assert(norm(R,inf), 0, 1e-9); ***** test - % test size and value of return values - r1 = rand(2,3,4); - V1 = stokes_unpolarized(r1); - r2 = rand(1,1); - V2 = stokes_unpolarized(r2); - [i1,i2] = stokes_intensity(V1,V2); - assert(all(i1==r1) && all(i2==r2)); -2 tests, 2 passed, 0 known failure, 0 skipped -[inst/stokes_degpolarization.m] ->>>>> /build/reproducible-path/octave-optics-0.1.4/inst/stokes_degpolarization.m + for dim = 1:5 + asize = randi([1 4], 1, dim); + C = cell(asize); + csize = size(C); + U = jones_unity(C); + usize = size(U); + assert(usize == csize); + end + ***** test - % test size of return values - r1 = rand(2,3,4); - V1 = stokes_unpolarized(r1); - r2 = rand(4,3,2); - V2 = stokes_unpolarized(r2); - [d1,d2] = stokes_degpolarization(V1,V2); - assert((size(d1)==size(r1)) && size(size(d2)==size(r2))); + for dim = 1:5 + asize = randi([1 4], 1, dim); + rsize = size(rand(asize)); + U = jones_unity(rsize); + usize = size(U); + assert(usize == rsize); + end +3 tests, 3 passed, 0 known failure, 0 skipped +[inst/mueller_homogeneous_elliptic_retarder.m] +>>>>> /build/reproducible-path/octave-optics-0.1.4/inst/mueller_homogeneous_elliptic_retarder.m +***** test + % test default return value + A = mueller_homogeneous_elliptic_retarder(); + R = A*A-A; + assert(norm(R,inf), 0, 1e-9); ***** test - % test return values - r1 = rand(1,1); - V1 = stokes_cpleft(r1)+stokes_unpolarized(1-r1); - r2 = rand(1,1); - V2 = stokes_unpolarized(r2); - [d1,d2] = stokes_degpolarization(V1,V2); - assert((d1==r1) && (d2==0)); -2 tests, 2 passed, 0 known failure, 0 skipped -[inst/mueller_rotator.m] ->>>>> /build/reproducible-path/octave-optics-0.1.4/inst/mueller_rotator.m + % test modes + t0 = rand(1,1); + delay = rand(1,1); + azimuth = rand(1,1); + ellipticity = rand(1,1); + A1 = mueller_homogeneous_elliptic_retarder(t0,delay,azimuth,ellipticity); + A2 = mueller_homogeneous_elliptic_retarder(t0,delay*180/pi(),azimuth,ellipticity,'deg'); + A3 = mueller_homogeneous_elliptic_retarder(t0,delay/(2*pi()),azimuth,ellipticity,'wav'); + A4 = mueller_homogeneous_elliptic_retarder(t0,delay,azimuth*180/pi(),ellipticity,'rad','deg'); + R = (A2-A1)+(A3-A1)+(A4-A1); + assert(norm(R,inf), 0, 1e-9); + +***** test + % another test correct size of return values + t0 = rand(3,4,5); + delay = rand(4,5,6); + azimuth = rand(5,4,3); + ellipticity = rand(6,5,4); + C = mueller_homogeneous_elliptic_retarder(t0,delay,azimuth,ellipticity); + csize = size(C); + assert(csize == [6,5,6]); +3 tests, 3 passed, 0 known failure, 0 skipped +[inst/stokes_lpplus45.m] +>>>>> /build/reproducible-path/octave-optics-0.1.4/inst/stokes_lpplus45.m ***** test % test default return value - A = mueller_rotator(); + V = stokes_lpplus45(); + R = V-[1;0;1;0]; + assert(norm(R,inf), 0, 1e-9); + +***** test + % test return value + intensity = rand(1, 1); + V = stokes_lpplus45(intensity); + R = V-[1;0;1;0]*intensity; + assert(norm(R,inf), 0, 1e-9); + +***** test + % test correct size of return values + for dim = 1:5 + asize = randi([1 4], 1, dim); + R = rand(asize); + if numel(R) == 1 + R = {R}; + end + rsize = size(R); + C = stokes_lpplus45(R); + csize = size(C); + assert(rsize == csize); + end +3 tests, 3 passed, 0 known failure, 0 skipped +[inst/mueller_rotate.m] +>>>>> /build/reproducible-path/octave-optics-0.1.4/inst/mueller_rotate.m +***** test + % default return value: unity matrix + A = mueller_rotate(); R = A*A-A; assert(norm(R,inf), 0, 1e-9); ***** test - % test serial application of rotator + % rotation by 0 should do nothing + delay = rand(1,1); + M = mueller_linretarder(delay); + A = mueller_rotate(M, 0); + R = M-A; + assert(norm(R,inf), 0, 1e-9); + +***** test + % undo rotation by 2nd opposite rotation + delay = rand(1,1); angle = rand(1, 1); - A1 = mueller_rotator(angle); - A2 = mueller_rotator(angle*2); - R = A1*A1-A2; + M = mueller_linretarder(delay); + A1 = mueller_rotate(M, angle); + A2 = mueller_rotate(A1, -angle); + R = A2-M; assert(norm(R,inf), 0, 1e-9); ***** test - % another test of serial application of rotator + % test serial application of rotation + delay = rand(1,1); angle1 = rand(1, 1); angle2 = rand(1, 1); - A1 = mueller_rotator(angle1); - A2 = mueller_rotator(angle2); - A12 = mueller_rotator(angle1+angle2); - R = A1*A2-A12; + M = mueller_linretarder(delay); + A1 = mueller_rotate(M, angle1); + A2 = mueller_rotate(A1, angle2); + A12 = mueller_rotate(M, angle1+angle2); + R = A2-A12; assert(norm(R,inf), 0, 1e-9); ***** test - % test different angle value interpretations + % testing MODE parameter angle = rand(1, 1); - A1 = mueller_rotator(angle); - A2 = mueller_rotator(-angle*180/pi(), 'deg'); - R = A2*A1-mueller_unity(); + A1 = mueller_rotate(mueller_waveplate(0.5), angle, 'rad'); + A2 = mueller_rotate(mueller_waveplate(0.5), angle*180/pi(), 'deg'); + R = A2-A1; assert(norm(R,inf), 0, 1e-9); ***** test - % test size of return values + % size of return value determined by 1st argument + angle = rand(1,1); + for dim = 1:5 + asize = randi([1 4], 1, dim); + rsize = size(rand(asize)); + C = mueller_rotate(mueller_unity(rsize), angle); + csize = size(C); + assert(rsize == csize); + end + +***** test + % size if return value determined by 2nd argument for dim = 1:5 asize = randi([1 4], 1, dim); R = rand(asize); @@ -4180,54 +4532,49 @@ R = {R}; end rsize = size(R); - C = mueller_rotator(R); + C = mueller_rotate(mueller_unity(), R); csize = size(C); assert(rsize == csize); end -5 tests, 5 passed, 0 known failure, 0 skipped -[inst/zernike_cartesian.m] ->>>>> /build/reproducible-path/octave-optics-0.1.4/inst/zernike_cartesian.m -***** demo - t = linspace (-1, 1, 80); - [x, y] = meshgrid (t, t); - max_order = 16; - Z = zernike_cartesian (x, y, max_order); - for k = 1:max_order - subplot (4, 4, k) - factors = zeros (max_order, 1); - factors(k) = 1; - z = reshape (Z*factors, size (x)); - imagesc (z) - axis ("off", "equal") - zname = strrep (zernike_name (k), " ", "\n"); - title (zname) - endfor -***** demo - n=30; - [x,y,z] = sombrero (n); - z += 0.05 * peaks (x./4, y./4); - z += 0.02 * x; - figure - surf (x, y, z) - title ("Original sombrero + peaks + tilt"); - - ## approximate sombrero+peaks - d = 10; - x /= d; - y /= d; - max_order = 50; - Z = zernike_cartesian (x, y, max_order, false); - f = Z\z(:); - ## create approximated plot - z_approx = reshape (Z * f, n, n); - figure - surf (10 * x, 10 * y, z_approx) - title ("approximated"); -***** assert (zernike_cartesian (0, 0, 1), 1) -***** error (zernike_cartesian (0, 0, 0)) -***** error (zernike_cartesian (0, 0, pi)) -***** error (zernike_cartesian ()) -4 tests, 4 passed, 0 known failure, 0 skipped + +***** test + % size if return value determined by both argument + M = mueller_unity([4,3,2]); + angle = rand(2,3,4); + C = mueller_rotate(M, angle); + csize = size(C); + assert(csize == [4,3,4]); + +8 tests, 8 passed, 0 known failure, 0 skipped +[inst/jones_cpright.m] +>>>>> /build/reproducible-path/octave-optics-0.1.4/inst/jones_cpright.m +***** test + % test default return value + V = jones_cpright(); + R = V-[1;1i]; + assert(norm(R,inf), 0, 1e-9); + +***** test + % test return value + amplitude = rand(1, 1); + V = jones_cpright(amplitude); + R = V-[1;1i]*amplitude; + assert(norm(R,inf), 0, 1e-9); + +***** test + % test correct size of return values + for dim = 1:5 + asize = randi([1 4], 1, dim); + R = rand(asize); + if numel(R) == 1 + R = {R}; + end + rsize = size(R); + C = jones_cpright(R); + csize = size(C); + assert(rsize == csize); + end +3 tests, 3 passed, 0 known failure, 0 skipped [inst/mueller_homogeneous_elliptic_diattenuator.m] >>>>> /build/reproducible-path/octave-optics-0.1.4/inst/mueller_homogeneous_elliptic_diattenuator.m ***** test @@ -4257,19 +4604,38 @@ csize = size(C); assert(csize == [6,5,6]); 3 tests, 3 passed, 0 known failure, 0 skipped -[inst/jones_lpvertical.m] ->>>>> /build/reproducible-path/octave-optics-0.1.4/inst/jones_lpvertical.m +[inst/zernike_R_poly.m] +>>>>> /build/reproducible-path/octave-optics-0.1.4/inst/zernike_R_poly.m +***** assert (zernike_R_poly (0, 0), [1]) +***** assert (zernike_R_poly (1, 1), [1 0]) +***** assert (zernike_R_poly (0, 2), [2 0 -1]) +***** assert (zernike_R_poly (2, 2), [1 0 0]) +***** assert (zernike_R_poly (1, 3), [3 0 -2 0]) +***** assert (zernike_R_poly (3, 3), [1 0 0 0]) +***** assert (zernike_R_poly (0, 4), [6 0 -6 0 1]) +***** assert (zernike_R_poly (2, 4), [4 0 -3 0 0]) +***** assert (zernike_R_poly (4, 4), [1 0 0 0 0]) +***** assert (zernike_R_poly (1, 5), [10 0 -12 0 3 0]) +***** assert (zernike_R_poly (3, 5), [5 0 -4 0 0 0]) +***** assert (zernike_R_poly (5, 5), [1 0 0 0 0 0]) +***** assert (zernike_R_poly (0, 6), [20 0 -30 0 12 0 -1]) +***** assert (zernike_R_poly (2, 6), [15 0 -20 0 6 0 0]) +***** assert (zernike_R_poly (4, 6), [ 6 0 -5 0 0 0 0]) +***** assert (zernike_R_poly (6, 6), [ 1 0 0 0 0 0 0]) +16 tests, 16 passed, 0 known failure, 0 skipped +[inst/jones_cpleft.m] +>>>>> /build/reproducible-path/octave-optics-0.1.4/inst/jones_cpleft.m ***** test % test default return value - V = jones_lpvertical(); - R = V-[0;1]; + V = jones_cpleft(); + R = V-[1;-1i]; assert(norm(R,inf), 0, 1e-9); ***** test % test return value amplitude = rand(1, 1); - V = jones_lpvertical(amplitude); - R = V-[0;1]*amplitude; + V = jones_cpleft(amplitude); + R = V-[1;-1i]*amplitude; assert(norm(R,inf), 0, 1e-9); ***** test @@ -4281,46 +4647,133 @@ R = {R}; end rsize = size(R); - C = jones_lpvertical(R); + C = jones_cpleft(R); csize = size(C); assert(rsize == csize); end 3 tests, 3 passed, 0 known failure, 0 skipped -[inst/jones_linretarder.m] ->>>>> /build/reproducible-path/octave-optics-0.1.4/inst/jones_linretarder.m +[inst/zernike_polar.m] +>>>>> /build/reproducible-path/octave-optics-0.1.4/inst/zernike_polar.m +***** test + r = 0.2; + phi = 1.23; + n = 4; + ret = zernike_polar (r, phi, n); + assert (ret, [1 r*cos(phi) r*sin(phi) 2*r^2-1], 5*eps) +***** test + r = [0.5 0.8]; + phi = [pi/4 pi/4]; + n = 4; + ret = zernike_polar (r, phi, n); + assert (ret, [1 r(1)*cos(phi(1)) r(1)*sin(phi(1)) 2*r(1)^2-1; 1 r(2)*cos(phi(2)) r(2)*sin(phi(2)) 2*r(2)^2-1], 5*eps) +2 tests, 2 passed, 0 known failure, 0 skipped +[inst/mueller_ismueller.m] +>>>>> /build/reproducible-path/octave-optics-0.1.4/inst/mueller_ismueller.m +***** test + % test type check + A1 = mueller_unity(); + A2 = char(A1); + t1 = mueller_ismueller(A1); + t2 = mueller_ismueller(A2); + assert(t1 && ~t2); + +***** test + % test size check + A1 = mueller_unity(); + A2 = A1; + A2(5,5) = 1; + t1 = mueller_ismueller(A1); + t2 = mueller_ismueller(A2); + assert(t1 && ~t2); + +***** test + % test size of return value + A1 = mueller_mirror([2,3,4]); + A1{2,2,2} = 0; + A2 = mueller_mirror([4,3,2]); + A2{1,1,1} = 0; + t1 = mueller_ismueller(A1); + t2 = mueller_ismueller(A2); + assert((size(A1)==size(t1)) && (size(A2)==size(t2))); + +***** test + % test indivial elements of return value + A1 = mueller_mirror([2,3,4]); + A1{2,2,2} = 0; + A2 = mueller_mirror([4,3,2]); + A2{1,1,1} = 0; + t1 = mueller_ismueller(A1); + t2 = mueller_ismueller(A2); + assert(t1(1,1,1) && ~t1(2,2,2) && ~t2(1,1,1) && t2(2,2,2)); +4 tests, 4 passed, 0 known failure, 0 skipped +[inst/jones_intensity.m] +>>>>> /build/reproducible-path/octave-optics-0.1.4/inst/jones_intensity.m +***** test + % test size and value of return values + r1 = rand(2,3,4); + V1 = jones_lphorizontal(sqrt(r1)); + r2 = rand(4,3,2); + V2 = jones_lpvertical(sqrt(r2)); + i1 = jones_intensity(V1); + i2 = jones_intensity(V2); + d1 = i1-r1; + d2 = i2-r2; + assert(max(d1(:))+max(d2(:)), 0, 1e-9); + +***** test + % test size and value of return values + r1 = rand(2,3,4); + V1 = jones_lphorizontal(sqrt(r1)); + r2 = rand(1,1); + V2 = jones_lpvertical(sqrt(r2)); + [i1,i2] = jones_intensity(V1,V2); + d1 = i1-r1; + d2 = i2-r2; + assert(max(d1(:))+max(d2(:)), 0, 1e-9); +2 tests, 2 passed, 0 known failure, 0 skipped +[inst/stokes_cpright.m] +>>>>> /build/reproducible-path/octave-optics-0.1.4/inst/stokes_cpright.m ***** test % test default return value - A = jones_linretarder(); - R = A*A-A; + V = stokes_cpright(); + R = V-[1;0;0;1]; assert(norm(R,inf), 0, 1e-9); ***** test - % test serial application of linear retarder elements - phase = rand(1, 1); - A1 = jones_linretarder(phase); - A2 = jones_linretarder(phase*2); - R = A1*A1-A2; + % test return value + intensity = rand(1, 1); + V = stokes_cpright(intensity); + R = V-[1;0;0;1]*intensity; assert(norm(R,inf), 0, 1e-9); ***** test - % another test of serial application of retarder elements - phase1 = rand(1, 1); - phase2 = rand(1, 1); - A1 = jones_linretarder(phase1); - A2 = jones_linretarder(phase2); - A12 = jones_linretarder(phase1+phase2); - R = A1*A2-A12; + % test correct size of return values + for dim = 1:5 + asize = randi([1 4], 1, dim); + R = rand(asize); + if numel(R) == 1 + R = {R}; + end + rsize = size(R); + C = stokes_cpright(R); + csize = size(C); + assert(rsize == csize); + end +3 tests, 3 passed, 0 known failure, 0 skipped +[inst/stokes_lpvertical.m] +>>>>> /build/reproducible-path/octave-optics-0.1.4/inst/stokes_lpvertical.m +***** test + % test default return value + V = stokes_lpvertical(); + R = V-[1;-1;0;0]; assert(norm(R,inf), 0, 1e-9); ***** test - % test mode - phase = rand(1, 1); - A1 = jones_linretarder(phase); - A2 = jones_linretarder(phase*180/pi(), 'deg'); - A3 = jones_linretarder(phase/(2*pi()), 'wav'); - R1 = A1-A2; - R2 = A1-A3; - assert(norm(R1,inf)+norm(R2,inf), 0, 1e-9); + % test return value + intensity = rand(1, 1); + V = stokes_lpvertical(intensity); + R = V-[1;-1;0;0]*intensity; + assert(norm(R,inf), 0, 1e-9); ***** test % test correct size of return values @@ -4331,11 +4784,11 @@ R = {R}; end rsize = size(R); - C = jones_linretarder(R); + C = stokes_lpvertical(R); csize = size(C); assert(rsize == csize); end -5 tests, 5 passed, 0 known failure, 0 skipped +3 tests, 3 passed, 0 known failure, 0 skipped [inst/mueller_lindiattenuator.m] >>>>> /build/reproducible-path/octave-optics-0.1.4/inst/mueller_lindiattenuator.m ***** test @@ -4408,19 +4861,111 @@ csize = size(C); assert(csize == [5,4,5]); 7 tests, 7 passed, 0 known failure, 0 skipped -[inst/stokes_lpplus45.m] ->>>>> /build/reproducible-path/octave-optics-0.1.4/inst/stokes_lpplus45.m +[inst/jones.m] +>>>>> /build/reproducible-path/octave-optics-0.1.4/inst/jones.m +***** error A = jones(); +***** test + % test singular argument, should just be returned + M = jones_waveplate(rand(1,1),'wav'); + MM = jones(M); + R = MM-M; + assert(norm(R,inf), 0, 1e-9); +***** test + % send light with horizontal linear polarization through a rotating + % 1/2-waveplate and subsequent polarizer: final intensity should + % vary as cos(2*angle)^2. + % This test feeds jones() with one cell array only! + angles = 0:360; + wps = jones_rotate(jones_waveplate(0.5, 'wav'), angles, 'deg'); + lightin = jones_lphorizontal(); + lightout = jones(jones_linpolarizer(),wps,lightin); + ilightout = jones_intensity(lightout); + R = ilightout-(cosd(angles.*2).^2); + assert(norm(R,inf), 0, 1e-9); +***** test + % this is a more thorough test: send light with horizontal linear + % polarization through two rotating 1/2-waveplates (combining to + % a 1/1-waveplate) and subsequent polarizer: final intensity + % should not vary! + % This test feeds jones() with two cell arrays. + angles = 0:360; + wps1 = jones_rotate(jones_waveplate(0.5, 'wav'), angles, 'deg'); + wps2 = jones_rotate(jones_waveplate(0.5, 'wav'), angles, 'deg'); + lightin = jones_lphorizontal(); + lightout = jones(jones_linpolarizer(),wps2,wps1,lightin); + ilightout = jones_intensity(lightout); + R = ilightout-1; + assert(norm(R,inf), 0, 1e-9); +***** demo + angles = 0:360; + wps = jones_rotate(jones_waveplate(0.5, 'wav'), angles, 'deg'); + lightin = jones_lphorizontal(); + lightout = jones(jones_linpolarizer(),wps,lightin); + ilightout = jones_intensity(lightout); + figure(); + plot(angles, ilightout); + title('transmitted intensity [should look like cos(2*a)^2'); + xlabel('angle of halfwave plate axis'); + ylabel('intensity [a.u.]'); + legend('transmitted intensity'); + % ----------------------------------------------------------------- + % example 1: send light with horizontal linear polarization through + % a rotating, perfect halfwave plate and subsequent polarizer: + % final intensity should vary as cos(2*angle)^2. +***** demo + angles = 0:360; + wps = jones_rotate(jones_waveplate(0.5, 'wav'), angles, 'deg'); + wps2 = jones_rotate(jones_waveplate(0.45, 'wav'), angles, 'deg'); + lightin = jones_lphorizontal(); + lightout = jones(jones_linpolarizer(),wps,lightin); + ilightout = jones_intensity(lightout); + lightout2 = jones(jones_linpolarizer(),wps2,lightin); + ilightout2 = jones_intensity(lightout2); + figure(); + plot(angles, ilightout, angles, ilightout2); + title('transmitted intensity with perfect and non-perfect halfwave plate'); + xlabel('angle of halfwave plate axis'); + ylabel('intensity [a.u.]'); + legend('perfect (0.5-)plate', 'non-perfect (0.45-)plate'); + % ----------------------------------------------------------------- + % example 2: send light with horizontal linear polarization through + % a rotating, non-perfect halfwave plate and subsequent polarizer: + % final intensity should deviate from the perfect cos(2*angle)^2 + % curve, never reaching zero transmission +***** demo + angle = 0:360; + delay = 0:0.05:1; + % angles are in rows, delays in columns + angle_all = repmat(angle, [length(delay), 1]); + delay_all = repmat(delay', [1, length(angle)]); + wps3 = jones_waveplate(delay_all, 'wav'); + wps3 = jones_rotate(wps3, angle_all, 'deg'); + lightin = jones_lphorizontal(); + lightout3 = jones(jones_linpolarizer(),wps3,lightin); + ilightout3 = jones_intensity(lightout3); + figure(); + plot(angle, ilightout3); + title('transmitted intensity with plates of increasing delay'); + xlabel('angle of plate axis'); + ylabel('intensity [a.u.]'); + legend(cellfun(@(x)sprintf('delay=%.2f',x),num2cell(delay),'UniformOutput',false)); + % ----------------------------------------------------------------- + % example 3: send light with horizontal linear polarization through + % rotating waveplates with increasing delay and subsequent polarizer +4 tests, 4 passed, 0 known failure, 0 skipped +[inst/jones_lpvertical.m] +>>>>> /build/reproducible-path/octave-optics-0.1.4/inst/jones_lpvertical.m ***** test % test default return value - V = stokes_lpplus45(); - R = V-[1;0;1;0]; + V = jones_lpvertical(); + R = V-[0;1]; assert(norm(R,inf), 0, 1e-9); ***** test % test return value - intensity = rand(1, 1); - V = stokes_lpplus45(intensity); - R = V-[1;0;1;0]*intensity; + amplitude = rand(1, 1); + V = jones_lpvertical(amplitude); + R = V-[0;1]*amplitude; assert(norm(R,inf), 0, 1e-9); ***** test @@ -4432,61 +4977,54 @@ R = {R}; end rsize = size(R); - C = stokes_lpplus45(R); + C = jones_lpvertical(R); csize = size(C); assert(rsize == csize); end 3 tests, 3 passed, 0 known failure, 0 skipped -[inst/jones_unity.m] ->>>>> /build/reproducible-path/octave-optics-0.1.4/inst/jones_unity.m +[inst/jones_mirror.m] +>>>>> /build/reproducible-path/octave-optics-0.1.4/inst/jones_mirror.m ***** test - A = jones_unity(); - R = A*A-A; + % test mirror that is its own inverted element + A = jones_mirror(); + R = (A-1\A); assert(norm(R,inf), 0, 1e-9); ***** test + % test direct size parameter for dim = 1:5 asize = randi([1 4], 1, dim); - C = cell(asize); - csize = size(C); - U = jones_unity(C); + rsize = size(rand(asize)); + U = jones_mirror(rsize); usize = size(U); - assert(usize == csize); + assert(usize == rsize); end ***** test + % test indirect size parameter for dim = 1:5 asize = randi([1 4], 1, dim); - rsize = size(rand(asize)); - U = jones_unity(rsize); + C = cell(asize); + csize = size(C); + U = jones_mirror(C); usize = size(U); - assert(usize == rsize); + assert(usize == csize); end + 3 tests, 3 passed, 0 known failure, 0 skipped -[inst/mueller_waveplate.m] ->>>>> /build/reproducible-path/octave-optics-0.1.4/inst/mueller_waveplate.m +[inst/stokes_lpminus45.m] +>>>>> /build/reproducible-path/octave-optics-0.1.4/inst/stokes_lpminus45.m ***** test % test default return value - A = mueller_waveplate(); - R = A*A-A; - assert(norm(R,inf), 0, 1e-9); - -***** test - % test serial application of absorptive elements - delay = rand(1, 1); - A1 = mueller_waveplate(delay); - A2 = mueller_waveplate(delay*2); - R = A1*A1-A2; + V = stokes_lpminus45(); + R = V-[1;0;-1;0]; assert(norm(R,inf), 0, 1e-9); ***** test - % another test of serial application of absorptive elements - delay1 = rand(1, 1); - delay2 = rand(1, 1); - A1 = mueller_waveplate(delay1); - A2 = mueller_waveplate(delay2); - A12 = mueller_waveplate(delay1+delay2); - R = A1*A2-A12; + % test return value + intensity = rand(1, 1); + V = stokes_lpminus45(intensity); + R = V-[1;0;-1;0]*intensity; assert(norm(R,inf), 0, 1e-9); ***** test @@ -4498,122 +5036,11 @@ R = {R}; end rsize = size(R); - C = mueller_waveplate(R); + C = stokes_lpminus45(R); csize = size(C); assert(rsize == csize); end -4 tests, 4 passed, 0 known failure, 0 skipped -[inst/mueller_linpolarizer.m] ->>>>> /build/reproducible-path/octave-optics-0.1.4/inst/mueller_linpolarizer.m -***** test - % applying a linear polarizer twice is identical to - % apply it once! - A = mueller_linpolarizer(); - R = A*A-A; - assert(norm(R,inf), 0, 1e-9); - -***** test - % test direct size parameter - for dim = 1:5 - asize = randi([1 4], 1, dim); - rsize = size(rand(asize)); - U = mueller_linpolarizer(rsize); - usize = size(U); - assert(usize == rsize); - end - -***** test - % test indirect size parameter - for dim = 1:5 - asize = randi([1 4], 1, dim); - C = cell(asize); - csize = size(C); - U = mueller_linpolarizer(C); - usize = size(U); - assert(usize == csize); - end - 3 tests, 3 passed, 0 known failure, 0 skipped -[inst/zernike_osa_ansi_to_mn.m] ->>>>> /build/reproducible-path/octave-optics-0.1.4/inst/zernike_osa_ansi_to_mn.m -***** test - [m,n]=zernike_osa_ansi_to_mn(0); - assert([m n],[0 0]) - [m,n]=zernike_osa_ansi_to_mn(1); - assert([m n],[-1 1]) - [m,n]=zernike_osa_ansi_to_mn(2); - assert([m n],[1 1]) - [m,n]=zernike_osa_ansi_to_mn(3); - assert([m n],[-2 2]) - [m,n]=zernike_osa_ansi_to_mn(4); - assert([m n],[0 2]) - [m,n]=zernike_osa_ansi_to_mn(5); - assert([m n],[2 2]) - [m,n]=zernike_osa_ansi_to_mn(6); - assert([m n],[-3 3]) - [m,n]=zernike_osa_ansi_to_mn(7); - assert([m n],[-1 3]) - [m,n]=zernike_osa_ansi_to_mn(8); - assert([m n],[1 3]) - [m,n]=zernike_osa_ansi_to_mn(9); - assert([m n],[3 3]) - [m,n]=zernike_osa_ansi_to_mn(10); - assert([m n],[-4 4]) - [m,n]=zernike_osa_ansi_to_mn(11); - assert([m n],[-2 4]) - [m,n]=zernike_osa_ansi_to_mn(12); - assert([m n],[0 4]) - [m,n]=zernike_osa_ansi_to_mn(13); - assert([m n],[2 4]) - [m,n]=zernike_osa_ansi_to_mn(14); - assert([m n],[4 4]) - [m,n]=zernike_osa_ansi_to_mn(15); - assert([m n],[-5 5]) - [m,n]=zernike_osa_ansi_to_mn(16); - assert([m n],[-3 5]) - [m,n]=zernike_osa_ansi_to_mn(17); - assert([m n],[-1 5]) - [m,n]=zernike_osa_ansi_to_mn(18); - assert([m n],[1 5]) - [m,n]=zernike_osa_ansi_to_mn(19); - assert([m n],[3 5]) - [m,n]=zernike_osa_ansi_to_mn(20); - assert([m n],[5 5]) - [m,n]=zernike_osa_ansi_to_mn(21); - assert([m n],[-6 6]) - [m,n]=zernike_osa_ansi_to_mn(22); - assert([m n],[-4 6]) - [m,n]=zernike_osa_ansi_to_mn(23); - assert([m n],[-2 6]) - [m,n]=zernike_osa_ansi_to_mn(24); - assert([m n],[0 6]) - [m,n]=zernike_osa_ansi_to_mn(25); - assert([m n],[2 6]) - [m,n]=zernike_osa_ansi_to_mn(26); - assert([m n],[4 6]) - [m,n]=zernike_osa_ansi_to_mn(27); - assert([m n],[6 6]) - [m,n]=zernike_osa_ansi_to_mn(28); - assert([m n],[-7 7]) - [m,n]=zernike_osa_ansi_to_mn(29); - assert([m n],[-5 7]) - [m,n]=zernike_osa_ansi_to_mn(30); - assert([m n],[-3 7]) - [m,n]=zernike_osa_ansi_to_mn(31); - assert([m n],[-1 7]) - [m,n]=zernike_osa_ansi_to_mn(32); - assert([m n],[1 7]) - [m,n]=zernike_osa_ansi_to_mn(33); - assert([m n],[3 7]) - [m,n]=zernike_osa_ansi_to_mn(34); - assert([m n],[5 7]) - [m,n]=zernike_osa_ansi_to_mn(35); - assert([m n],[7 7]) -***** test - [m,n]=zernike_osa_ansi_to_mn([2 7 15 35]); - assert(m,[1 -1 -5 7]) - assert(n,[1 3 5 7]) -2 tests, 2 passed, 0 known failure, 0 skipped [inst/mueller_stokes.m] >>>>> /build/reproducible-path/octave-optics-0.1.4/inst/mueller_stokes.m ***** error A = mueller_stokes(); @@ -4706,22 +5133,43 @@ % example 3: send light with horizontal linear polarization through % rotating waveplates with increasing delay and subsequent polarizer 4 tests, 4 passed, 0 known failure, 0 skipped -[inst/stokes_lpminus45.m] ->>>>> /build/reproducible-path/octave-optics-0.1.4/inst/stokes_lpminus45.m +[inst/mueller_circretarder.m] +>>>>> /build/reproducible-path/octave-optics-0.1.4/inst/mueller_circretarder.m ***** test % test default return value - V = stokes_lpminus45(); - R = V-[1;0;-1;0]; + A = mueller_circretarder(); + R = A*A-A; assert(norm(R,inf), 0, 1e-9); ***** test - % test return value - intensity = rand(1, 1); - V = stokes_lpminus45(intensity); - R = V-[1;0;-1;0]*intensity; + % test serial application of circular retarder elements + phase = rand(1, 1); + A1 = mueller_circretarder(phase); + A2 = mueller_circretarder(phase*2); + R = A1*A1-A2; assert(norm(R,inf), 0, 1e-9); ***** test + % another test of serial application of retarder elements + phase1 = rand(1, 1); + phase2 = rand(1, 1); + A1 = mueller_circretarder(phase1); + A2 = mueller_circretarder(phase2); + A12 = mueller_circretarder(phase1+phase2); + R = A1*A2-A12; + assert(norm(R,inf), 0, 1e-9); + +***** test + % test mode + phase = rand(1, 1); + A1 = mueller_circretarder(phase); + A2 = mueller_circretarder(phase*180/pi(), 'deg'); + A3 = mueller_circretarder(phase/(2*pi()), 'wav'); + R1 = A1-A2; + R2 = A1-A3; + assert(norm(R1,inf)+norm(R2,inf), 0, 1e-9); + +***** test % test correct size of return values for dim = 1:5 asize = randi([1 4], 1, dim); @@ -4730,11 +5178,11 @@ R = {R}; end rsize = size(R); - C = stokes_lpminus45(R); + C = mueller_circretarder(R); csize = size(C); assert(rsize == csize); end -3 tests, 3 passed, 0 known failure, 0 skipped +5 tests, 5 passed, 0 known failure, 0 skipped [inst/jones_linpolarizer.m] >>>>> /build/reproducible-path/octave-optics-0.1.4/inst/jones_linpolarizer.m ***** test @@ -4766,65 +5214,58 @@ end 3 tests, 3 passed, 0 known failure, 0 skipped -[inst/mueller_rotate.m] ->>>>> /build/reproducible-path/octave-optics-0.1.4/inst/mueller_rotate.m +[inst/jones_lindiattenuator.m] +>>>>> /build/reproducible-path/octave-optics-0.1.4/inst/jones_lindiattenuator.m ***** test - % default return value: unity matrix - A = mueller_rotate(); + % test default return value + A = jones_lindiattenuator(); R = A*A-A; assert(norm(R,inf), 0, 1e-9); ***** test - % rotation by 0 should do nothing - delay = rand(1,1); - M = mueller_linretarder(delay); - A = mueller_rotate(M, 0); - R = M-A; - assert(norm(R,inf), 0, 1e-9); - -***** test - % undo rotation by 2nd opposite rotation - delay = rand(1,1); - angle = rand(1, 1); - M = mueller_linretarder(delay); - A1 = mueller_rotate(M, angle); - A2 = mueller_rotate(A1, -angle); - R = A2-M; + % test equality of providing diattenuation or kx and ky + d = rand(1, 1); + kx = 1; + ky = (1-d)./(1+d); + A1 = jones_lindiattenuator(d); + A2 = jones_lindiattenuator(kx, ky); + R = A1-A2; assert(norm(R,inf), 0, 1e-9); ***** test - % test serial application of rotation - delay = rand(1,1); - angle1 = rand(1, 1); - angle2 = rand(1, 1); - M = mueller_linretarder(delay); - A1 = mueller_rotate(M, angle1); - A2 = mueller_rotate(A1, angle2); - A12 = mueller_rotate(M, angle1+angle2); - R = A2-A12; + % test serial application of linear diattenuators + kx = rand(1, 1); + ky = rand(1, 1); + A1 = jones_lindiattenuator(kx,ky); + A2 = jones_lindiattenuator(kx*kx,ky*ky); + R = A1*A1-A2; assert(norm(R,inf), 0, 1e-9); ***** test - % testing MODE parameter - angle = rand(1, 1); - A1 = mueller_rotate(mueller_waveplate(0.5), angle, 'rad'); - A2 = mueller_rotate(mueller_waveplate(0.5), angle*180/pi(), 'deg'); - R = A2-A1; + % another test of serial application of retarder elements + kx1 = rand(1, 1); + kx2 = rand(1, 1); + ky1 = rand(1, 1); + ky2 = rand(1, 1); + A1 = jones_lindiattenuator(kx1,ky1); + A2 = jones_lindiattenuator(kx2,ky2); + A12 = jones_lindiattenuator(kx1*kx2,ky1*ky2); + R = A1*A2-A12; assert(norm(R,inf), 0, 1e-9); ***** test - % size of return value determined by 1st argument - angle = rand(1,1); - for dim = 1:5 - asize = randi([1 4], 1, dim); - rsize = size(rand(asize)); - C = mueller_rotate(mueller_unity(rsize), angle); - csize = size(C); - assert(rsize == csize); - end + % test mode + kx = rand(1, 1); + ky = rand(1, 1); + A1 = jones_lindiattenuator(kx,ky); + A2 = jones_lindiattenuator(kx,ky,'int'); + A3 = jones_lindiattenuator(sqrt(kx),sqrt(ky),'amp'); + R1 = A1-A2; + R2 = A1-A3; + assert(norm(R1,inf)+norm(R2,inf), 0, 1e-9); ***** test - % size if return value determined by 2nd argument + % test correct size of return values for dim = 1:5 asize = randi([1 4], 1, dim); R = rand(asize); @@ -4832,88 +5273,32 @@ R = {R}; end rsize = size(R); - C = mueller_rotate(mueller_unity(), R); + C = jones_lindiattenuator(R); csize = size(C); assert(rsize == csize); end ***** test - % size if return value determined by both argument - M = mueller_unity([4,3,2]); - angle = rand(2,3,4); - C = mueller_rotate(M, angle); + % another test correct size of return values + kx = rand(3,4,5); + ky = rand(5,4,3); + C = jones_lindiattenuator(kx,ky); csize = size(C); - assert(csize == [4,3,4]); - -8 tests, 8 passed, 0 known failure, 0 skipped -[inst/jones_intensity.m] ->>>>> /build/reproducible-path/octave-optics-0.1.4/inst/jones_intensity.m -***** test - % test size and value of return values - r1 = rand(2,3,4); - V1 = jones_lphorizontal(sqrt(r1)); - r2 = rand(4,3,2); - V2 = jones_lpvertical(sqrt(r2)); - i1 = jones_intensity(V1); - i2 = jones_intensity(V2); - d1 = i1-r1; - d2 = i2-r2; - assert(max(d1(:))+max(d2(:)), 0, 1e-9); - -***** test - % test size and value of return values - r1 = rand(2,3,4); - V1 = jones_lphorizontal(sqrt(r1)); - r2 = rand(1,1); - V2 = jones_lpvertical(sqrt(r2)); - [i1,i2] = jones_intensity(V1,V2); - d1 = i1-r1; - d2 = i2-r2; - assert(max(d1(:))+max(d2(:)), 0, 1e-9); -2 tests, 2 passed, 0 known failure, 0 skipped -[inst/mueller_mirror.m] ->>>>> /build/reproducible-path/octave-optics-0.1.4/inst/mueller_mirror.m -***** test - % test mirror that is its own inverted element - A = mueller_mirror(); - R = (A-1\A); - assert(norm(R,inf), 0, 1e-9); - -***** test - % test direct size parameter - for dim = 1:5 - asize = randi([1 4], 1, dim); - rsize = size(rand(asize)); - U = mueller_mirror(rsize); - usize = size(U); - assert(usize == rsize); - end - -***** test - % test indirect size parameter - for dim = 1:5 - asize = randi([1 4], 1, dim); - C = cell(asize); - csize = size(C); - U = mueller_mirror(C); - usize = size(U); - assert(usize == csize); - end - -3 tests, 3 passed, 0 known failure, 0 skipped -[inst/jones_rotator.m] ->>>>> /build/reproducible-path/octave-optics-0.1.4/inst/jones_rotator.m + assert(csize == [5,4,5]); +7 tests, 7 passed, 0 known failure, 0 skipped +[inst/mueller_rotator.m] +>>>>> /build/reproducible-path/octave-optics-0.1.4/inst/mueller_rotator.m ***** test % test default return value - A = jones_rotator(); + A = mueller_rotator(); R = A*A-A; assert(norm(R,inf), 0, 1e-9); ***** test % test serial application of rotator angle = rand(1, 1); - A1 = jones_rotator(angle); - A2 = jones_rotator(angle*2); + A1 = mueller_rotator(angle); + A2 = mueller_rotator(angle*2); R = A1*A1-A2; assert(norm(R,inf), 0, 1e-9); @@ -4921,18 +5306,18 @@ % another test of serial application of rotator angle1 = rand(1, 1); angle2 = rand(1, 1); - A1 = jones_rotator(angle1); - A2 = jones_rotator(angle2); - A12 = jones_rotator(angle1+angle2); + A1 = mueller_rotator(angle1); + A2 = mueller_rotator(angle2); + A12 = mueller_rotator(angle1+angle2); R = A1*A2-A12; assert(norm(R,inf), 0, 1e-9); ***** test % test different angle value interpretations angle = rand(1, 1); - A1 = jones_rotator(angle); - A2 = jones_rotator(-angle*180/pi(), 'deg'); - R = A2*A1-jones_unity(); + A1 = mueller_rotator(angle); + A2 = mueller_rotator(-angle*180/pi(), 'deg'); + R = A2*A1-mueller_unity(); assert(norm(R,inf), 0, 1e-9); ***** test @@ -4944,76 +5329,63 @@ R = {R}; end rsize = size(R); - C = jones_rotator(R); + C = mueller_rotator(R); csize = size(C); assert(rsize == csize); end 5 tests, 5 passed, 0 known failure, 0 skipped -[inst/zernike_name.m] ->>>>> /build/reproducible-path/octave-optics-0.1.4/inst/zernike_name.m -***** assert (zernike_name (4), "defocus") -***** assert (zernike_name (22), "-") -***** error (zernike_name (0)) -***** error (zernike_name ([1 2])) -***** error (zernike_name (pi)) -5 tests, 5 passed, 0 known failure, 0 skipped -[inst/stokes_lpvertical.m] ->>>>> /build/reproducible-path/octave-optics-0.1.4/inst/stokes_lpvertical.m +[inst/mueller_checkmueller.m] +>>>>> /build/reproducible-path/octave-optics-0.1.4/inst/mueller_checkmueller.m ***** test - % test default return value - V = stokes_lpvertical(); - R = V-[1;-1;0;0]; - assert(norm(R,inf), 0, 1e-9); + % test type check + A1 = mueller_unity(); + A2 = char(A1); + t1 = mueller_checkmueller(A1); + t2 = mueller_checkmueller(A2); + assert(t1 && ~t2); ***** test - % test return value - intensity = rand(1, 1); - V = stokes_lpvertical(intensity); - R = V-[1;-1;0;0]*intensity; - assert(norm(R,inf), 0, 1e-9); + % test size check + A1 = mueller_unity(); + A2 = A1; + A2(5,5) = 1; + t1 = mueller_checkmueller(A1); + t2 = mueller_checkmueller(A2); + assert(t1 && ~t2); ***** test - % test correct size of return values - for dim = 1:5 - asize = randi([1 4], 1, dim); - R = rand(asize); - if numel(R) == 1 - R = {R}; - end - rsize = size(R); - C = stokes_lpvertical(R); - csize = size(C); - assert(rsize == csize); - end -3 tests, 3 passed, 0 known failure, 0 skipped -[inst/zernike_polar.m] ->>>>> /build/reproducible-path/octave-optics-0.1.4/inst/zernike_polar.m -***** test - r = 0.2; - phi = 1.23; - n = 4; - ret = zernike_polar (r, phi, n); - assert (ret, [1 r*cos(phi) r*sin(phi) 2*r^2-1], 5*eps) + % test size of return value + A1 = mueller_mirror([2,3,4]); + A1{2,2,2} = 0; + A2 = mueller_mirror([4,3,2]); + A2{1,1,1} = 0; + t1 = mueller_checkmueller(A1); + t2 = mueller_checkmueller(A2); + assert((size(A1)==size(t1)) && (size(A2)==size(t2))); + ***** test - r = [0.5 0.8]; - phi = [pi/4 pi/4]; - n = 4; - ret = zernike_polar (r, phi, n); - assert (ret, [1 r(1)*cos(phi(1)) r(1)*sin(phi(1)) 2*r(1)^2-1; 1 r(2)*cos(phi(2)) r(2)*sin(phi(2)) 2*r(2)^2-1], 5*eps) -2 tests, 2 passed, 0 known failure, 0 skipped -[inst/mueller_circretarder.m] ->>>>> /build/reproducible-path/octave-optics-0.1.4/inst/mueller_circretarder.m + % test indivial elements of return value + A1 = mueller_mirror([2,3,4]); + A1{2,2,2} = ones(4,4)*0.99; + A2 = mueller_mirror([4,3,2]); + A2{1,1,1} = ones(4,4)*1.01; + t1 = mueller_checkmueller(A1); + t2 = mueller_checkmueller(A2); + assert(t1(1,1,1) && ~t1(2,2,2) && ~t2(1,1,1) && t2(2,2,2)); +4 tests, 4 passed, 0 known failure, 0 skipped +[inst/jones_linretarder.m] +>>>>> /build/reproducible-path/octave-optics-0.1.4/inst/jones_linretarder.m ***** test % test default return value - A = mueller_circretarder(); + A = jones_linretarder(); R = A*A-A; assert(norm(R,inf), 0, 1e-9); ***** test - % test serial application of circular retarder elements + % test serial application of linear retarder elements phase = rand(1, 1); - A1 = mueller_circretarder(phase); - A2 = mueller_circretarder(phase*2); + A1 = jones_linretarder(phase); + A2 = jones_linretarder(phase*2); R = A1*A1-A2; assert(norm(R,inf), 0, 1e-9); @@ -5021,18 +5393,18 @@ % another test of serial application of retarder elements phase1 = rand(1, 1); phase2 = rand(1, 1); - A1 = mueller_circretarder(phase1); - A2 = mueller_circretarder(phase2); - A12 = mueller_circretarder(phase1+phase2); + A1 = jones_linretarder(phase1); + A2 = jones_linretarder(phase2); + A12 = jones_linretarder(phase1+phase2); R = A1*A2-A12; assert(norm(R,inf), 0, 1e-9); ***** test % test mode phase = rand(1, 1); - A1 = mueller_circretarder(phase); - A2 = mueller_circretarder(phase*180/pi(), 'deg'); - A3 = mueller_circretarder(phase/(2*pi()), 'wav'); + A1 = jones_linretarder(phase); + A2 = jones_linretarder(phase*180/pi(), 'deg'); + A3 = jones_linretarder(phase/(2*pi()), 'wav'); R1 = A1-A2; R2 = A1-A3; assert(norm(R1,inf)+norm(R2,inf), 0, 1e-9); @@ -5046,17 +5418,98 @@ R = {R}; end rsize = size(R); - C = mueller_circretarder(R); + C = jones_linretarder(R); csize = size(C); assert(rsize == csize); end 5 tests, 5 passed, 0 known failure, 0 skipped -[inst/jones_mirror.m] ->>>>> /build/reproducible-path/octave-optics-0.1.4/inst/jones_mirror.m +[inst/zernike_osa_ansi_to_mn.m] +>>>>> /build/reproducible-path/octave-optics-0.1.4/inst/zernike_osa_ansi_to_mn.m ***** test - % test mirror that is its own inverted element - A = jones_mirror(); - R = (A-1\A); + [m,n]=zernike_osa_ansi_to_mn(0); + assert([m n],[0 0]) + [m,n]=zernike_osa_ansi_to_mn(1); + assert([m n],[-1 1]) + [m,n]=zernike_osa_ansi_to_mn(2); + assert([m n],[1 1]) + [m,n]=zernike_osa_ansi_to_mn(3); + assert([m n],[-2 2]) + [m,n]=zernike_osa_ansi_to_mn(4); + assert([m n],[0 2]) + [m,n]=zernike_osa_ansi_to_mn(5); + assert([m n],[2 2]) + [m,n]=zernike_osa_ansi_to_mn(6); + assert([m n],[-3 3]) + [m,n]=zernike_osa_ansi_to_mn(7); + assert([m n],[-1 3]) + [m,n]=zernike_osa_ansi_to_mn(8); + assert([m n],[1 3]) + [m,n]=zernike_osa_ansi_to_mn(9); + assert([m n],[3 3]) + [m,n]=zernike_osa_ansi_to_mn(10); + assert([m n],[-4 4]) + [m,n]=zernike_osa_ansi_to_mn(11); + assert([m n],[-2 4]) + [m,n]=zernike_osa_ansi_to_mn(12); + assert([m n],[0 4]) + [m,n]=zernike_osa_ansi_to_mn(13); + assert([m n],[2 4]) + [m,n]=zernike_osa_ansi_to_mn(14); + assert([m n],[4 4]) + [m,n]=zernike_osa_ansi_to_mn(15); + assert([m n],[-5 5]) + [m,n]=zernike_osa_ansi_to_mn(16); + assert([m n],[-3 5]) + [m,n]=zernike_osa_ansi_to_mn(17); + assert([m n],[-1 5]) + [m,n]=zernike_osa_ansi_to_mn(18); + assert([m n],[1 5]) + [m,n]=zernike_osa_ansi_to_mn(19); + assert([m n],[3 5]) + [m,n]=zernike_osa_ansi_to_mn(20); + assert([m n],[5 5]) + [m,n]=zernike_osa_ansi_to_mn(21); + assert([m n],[-6 6]) + [m,n]=zernike_osa_ansi_to_mn(22); + assert([m n],[-4 6]) + [m,n]=zernike_osa_ansi_to_mn(23); + assert([m n],[-2 6]) + [m,n]=zernike_osa_ansi_to_mn(24); + assert([m n],[0 6]) + [m,n]=zernike_osa_ansi_to_mn(25); + assert([m n],[2 6]) + [m,n]=zernike_osa_ansi_to_mn(26); + assert([m n],[4 6]) + [m,n]=zernike_osa_ansi_to_mn(27); + assert([m n],[6 6]) + [m,n]=zernike_osa_ansi_to_mn(28); + assert([m n],[-7 7]) + [m,n]=zernike_osa_ansi_to_mn(29); + assert([m n],[-5 7]) + [m,n]=zernike_osa_ansi_to_mn(30); + assert([m n],[-3 7]) + [m,n]=zernike_osa_ansi_to_mn(31); + assert([m n],[-1 7]) + [m,n]=zernike_osa_ansi_to_mn(32); + assert([m n],[1 7]) + [m,n]=zernike_osa_ansi_to_mn(33); + assert([m n],[3 7]) + [m,n]=zernike_osa_ansi_to_mn(34); + assert([m n],[5 7]) + [m,n]=zernike_osa_ansi_to_mn(35); + assert([m n],[7 7]) +***** test + [m,n]=zernike_osa_ansi_to_mn([2 7 15 35]); + assert(m,[1 -1 -5 7]) + assert(n,[1 3 5 7]) +2 tests, 2 passed, 0 known failure, 0 skipped +[inst/mueller_linpolarizer.m] +>>>>> /build/reproducible-path/octave-optics-0.1.4/inst/mueller_linpolarizer.m +***** test + % applying a linear polarizer twice is identical to + % apply it once! + A = mueller_linpolarizer(); + R = A*A-A; assert(norm(R,inf), 0, 1e-9); ***** test @@ -5064,7 +5517,7 @@ for dim = 1:5 asize = randi([1 4], 1, dim); rsize = size(rand(asize)); - U = jones_mirror(rsize); + U = mueller_linpolarizer(rsize); usize = size(U); assert(usize == rsize); end @@ -5075,25 +5528,36 @@ asize = randi([1 4], 1, dim); C = cell(asize); csize = size(C); - U = jones_mirror(C); + U = mueller_linpolarizer(C); usize = size(U); assert(usize == csize); end 3 tests, 3 passed, 0 known failure, 0 skipped -[inst/stokes_lphorizontal.m] ->>>>> /build/reproducible-path/octave-optics-0.1.4/inst/stokes_lphorizontal.m +[inst/mueller_absorber.m] +>>>>> /build/reproducible-path/octave-optics-0.1.4/inst/mueller_absorber.m ***** test % test default return value - V = stokes_lphorizontal(); - R = V-[1;1;0;0]; + A = mueller_absorber(); + R = A*A-A; assert(norm(R,inf), 0, 1e-9); ***** test - % test return value - intensity = rand(1, 1); - V = stokes_lphorizontal(intensity); - R = V-[1;1;0;0]*intensity; + % test serial appliation of absorptive elements + absorption = rand(1, 1); + A1 = mueller_absorber(absorption); + A2 = mueller_absorber(1-(1-absorption)^2); + R = A1*A1-A2; + assert(norm(R,inf), 0, 1e-9); + +***** test + % another test of serial appliation of absorptive elements + absorption1 = rand(1, 1); + absorption2 = rand(1, 1); + A1 = mueller_absorber(absorption1); + A2 = mueller_absorber(absorption2); + A12 = mueller_absorber(1-((1-absorption1)*(1-absorption2))); + R = A1*A2-A12; assert(norm(R,inf), 0, 1e-9); ***** test @@ -5105,104 +5569,28 @@ R = {R}; end rsize = size(R); - C = stokes_lphorizontal(R); + C = mueller_absorber(R); csize = size(C); assert(rsize == csize); end -3 tests, 3 passed, 0 known failure, 0 skipped -[inst/zernike_noll_to_mn.m] ->>>>> /build/reproducible-path/octave-optics-0.1.4/inst/zernike_noll_to_mn.m -***** test - [m,n]=zernike_noll_to_mn(1); - assert([m n],[0 0]) -***** test - [m,n]=zernike_noll_to_mn(2); - assert([m n],[1 1]) -***** test - [m,n]=zernike_noll_to_mn(3); - assert([m n],[-1 1]) -***** test - [m,n]=zernike_noll_to_mn(4); - assert([m n],[0 2]) -***** test - [m,n]=zernike_noll_to_mn(5); - assert([m n],[-2 2]) -***** test - [m,n]=zernike_noll_to_mn(20); - assert([m n],[5 5]) -***** test - [m,n]=zernike_noll_to_mn(34); - assert([m n],[5 7]) -***** test - [m,n]=zernike_noll_to_mn(35); - assert([m n],[-7 7]) -***** test - [m,n]=zernike_noll_to_mn(36); - assert([m n],[7 7]) -***** test - [m,n]=zernike_noll_to_mn([2 5 8 35]); - assert(m,[1 -2 1 -7]) - assert(n,[1 2 3 7]) -10 tests, 10 passed, 0 known failure, 0 skipped -[inst/jones_rotate.m] ->>>>> /build/reproducible-path/octave-optics-0.1.4/inst/jones_rotate.m -***** test - % default return value: unity matrix - A = jones_rotate(); - R = A*A-A; - assert(norm(R,inf), 0, 1e-9); - -***** test - % rotation by 0 should do nothing - delay = rand(1,1); - JM = jones_linretarder(delay); - A = jones_rotate(JM, 0); - R = JM-A; - assert(norm(R,inf), 0, 1e-9); - -***** test - % undo rotation by 2nd opposite rotation - delay = rand(1,1); - angle = rand(1, 1); - JM = jones_linretarder(delay); - A1 = jones_rotate(JM, angle); - A2 = jones_rotate(A1, -angle); - R = A2-JM; - assert(norm(R,inf), 0, 1e-9); - +4 tests, 4 passed, 0 known failure, 0 skipped +[inst/jones_lpminus45.m] +>>>>> /build/reproducible-path/octave-optics-0.1.4/inst/jones_lpminus45.m ***** test - % test serial application of rotation - delay = rand(1,1); - angle1 = rand(1, 1); - angle2 = rand(1, 1); - JM = jones_linretarder(delay); - A1 = jones_rotate(JM, angle1); - A2 = jones_rotate(A1, angle2); - A12 = jones_rotate(JM, angle1+angle2); - R = A2-A12; + % test default return value + V = jones_lpminus45(); + R = V-[1;-1]; assert(norm(R,inf), 0, 1e-9); ***** test - % testing MODE parameter - angle = rand(1, 1); - A1 = jones_rotate(jones_waveplate(0.5), angle, 'rad'); - A2 = jones_rotate(jones_waveplate(0.5), angle*180/pi(), 'deg'); - R = A2-A1; + % test return value + amplitude = rand(1, 1); + V = jones_lpminus45(amplitude); + R = V-[1;-1]*amplitude; assert(norm(R,inf), 0, 1e-9); ***** test - % size of return value determined by 1st argument - angle = rand(1,1); - for dim = 1:5 - asize = randi([1 4], 1, dim); - rsize = size(rand(asize)); - C = jones_rotate(jones_unity(rsize), angle); - csize = size(C); - assert(rsize == csize); - end - -***** test - % size if return value determined by 2nd argument + % test correct size of return values for dim = 1:5 asize = randi([1 4], 1, dim); R = rand(asize); @@ -5210,33 +5598,24 @@ R = {R}; end rsize = size(R); - C = jones_rotate(jones_unity(), R); + C = jones_lpminus45(R); csize = size(C); assert(rsize == csize); end - -***** test - % size if return value determined by both argument - JM = jones_unity([4,3,2]); - angle = rand(2,3,4); - C = jones_rotate(JM, angle); - csize = size(C); - assert(csize == [4,3,4]); - -8 tests, 8 passed, 0 known failure, 0 skipped -[inst/stokes_unpolarized.m] ->>>>> /build/reproducible-path/octave-optics-0.1.4/inst/stokes_unpolarized.m +3 tests, 3 passed, 0 known failure, 0 skipped +[inst/stokes_lphorizontal.m] +>>>>> /build/reproducible-path/octave-optics-0.1.4/inst/stokes_lphorizontal.m ***** test % test default return value - V = stokes_unpolarized(); - R = V-[1;0;0;0]; + V = stokes_lphorizontal(); + R = V-[1;1;0;0]; assert(norm(R,inf), 0, 1e-9); ***** test % test return value intensity = rand(1, 1); - V = stokes_unpolarized(intensity); - R = V-[1;0;0;0]*intensity; + V = stokes_lphorizontal(intensity); + R = V-[1;1;0;0]*intensity; assert(norm(R,inf), 0, 1e-9); ***** test @@ -5248,24 +5627,24 @@ R = {R}; end rsize = size(R); - C = stokes_unpolarized(R); + C = stokes_lphorizontal(R); csize = size(C); assert(rsize == csize); end 3 tests, 3 passed, 0 known failure, 0 skipped -[inst/jones_cpleft.m] ->>>>> /build/reproducible-path/octave-optics-0.1.4/inst/jones_cpleft.m +[inst/stokes_cpleft.m] +>>>>> /build/reproducible-path/octave-optics-0.1.4/inst/stokes_cpleft.m ***** test % test default return value - V = jones_cpleft(); - R = V-[1;-1i]; + V = stokes_cpleft(); + R = V-[1;0;0;-1]; assert(norm(R,inf), 0, 1e-9); ***** test % test return value - amplitude = rand(1, 1); - V = jones_cpleft(amplitude); - R = V-[1;-1i]*amplitude; + intensity = rand(1, 1); + V = stokes_cpleft(intensity); + R = V-[1;0;0;-1]*intensity; assert(norm(R,inf), 0, 1e-9); ***** test @@ -5277,55 +5656,24 @@ R = {R}; end rsize = size(R); - C = jones_cpleft(R); + C = stokes_cpleft(R); csize = size(C); assert(rsize == csize); end 3 tests, 3 passed, 0 known failure, 0 skipped -[inst/mueller_homogeneous_elliptic_retarder.m] ->>>>> /build/reproducible-path/octave-optics-0.1.4/inst/mueller_homogeneous_elliptic_retarder.m -***** test - % test default return value - A = mueller_homogeneous_elliptic_retarder(); - R = A*A-A; - assert(norm(R,inf), 0, 1e-9); - -***** test - % test modes - t0 = rand(1,1); - delay = rand(1,1); - azimuth = rand(1,1); - ellipticity = rand(1,1); - A1 = mueller_homogeneous_elliptic_retarder(t0,delay,azimuth,ellipticity); - A2 = mueller_homogeneous_elliptic_retarder(t0,delay*180/pi(),azimuth,ellipticity,'deg'); - A3 = mueller_homogeneous_elliptic_retarder(t0,delay/(2*pi()),azimuth,ellipticity,'wav'); - A4 = mueller_homogeneous_elliptic_retarder(t0,delay,azimuth*180/pi(),ellipticity,'rad','deg'); - R = (A2-A1)+(A3-A1)+(A4-A1); - assert(norm(R,inf), 0, 1e-9); - -***** test - % another test correct size of return values - t0 = rand(3,4,5); - delay = rand(4,5,6); - azimuth = rand(5,4,3); - ellipticity = rand(6,5,4); - C = mueller_homogeneous_elliptic_retarder(t0,delay,azimuth,ellipticity); - csize = size(C); - assert(csize == [6,5,6]); -3 tests, 3 passed, 0 known failure, 0 skipped -[inst/stokes_cpright.m] ->>>>> /build/reproducible-path/octave-optics-0.1.4/inst/stokes_cpright.m +[inst/stokes_unpolarized.m] +>>>>> /build/reproducible-path/octave-optics-0.1.4/inst/stokes_unpolarized.m ***** test % test default return value - V = stokes_cpright(); - R = V-[1;0;0;1]; + V = stokes_unpolarized(); + R = V-[1;0;0;0]; assert(norm(R,inf), 0, 1e-9); ***** test % test return value intensity = rand(1, 1); - V = stokes_cpright(intensity); - R = V-[1;0;0;1]*intensity; + V = stokes_unpolarized(intensity); + R = V-[1;0;0;0]*intensity; assert(norm(R,inf), 0, 1e-9); ***** test @@ -5337,246 +5685,81 @@ R = {R}; end rsize = size(R); - C = stokes_cpright(R); + C = stokes_unpolarized(R); csize = size(C); assert(rsize == csize); end 3 tests, 3 passed, 0 known failure, 0 skipped -[inst/mueller_ismueller.m] ->>>>> /build/reproducible-path/octave-optics-0.1.4/inst/mueller_ismueller.m -***** test - % test type check - A1 = mueller_unity(); - A2 = char(A1); - t1 = mueller_ismueller(A1); - t2 = mueller_ismueller(A2); - assert(t1 && ~t2); - -***** test - % test size check - A1 = mueller_unity(); - A2 = A1; - A2(5,5) = 1; - t1 = mueller_ismueller(A1); - t2 = mueller_ismueller(A2); - assert(t1 && ~t2); - -***** test - % test size of return value - A1 = mueller_mirror([2,3,4]); - A1{2,2,2} = 0; - A2 = mueller_mirror([4,3,2]); - A2{1,1,1} = 0; - t1 = mueller_ismueller(A1); - t2 = mueller_ismueller(A2); - assert((size(A1)==size(t1)) && (size(A2)==size(t2))); - -***** test - % test indivial elements of return value - A1 = mueller_mirror([2,3,4]); - A1{2,2,2} = 0; - A2 = mueller_mirror([4,3,2]); - A2{1,1,1} = 0; - t1 = mueller_ismueller(A1); - t2 = mueller_ismueller(A2); - assert(t1(1,1,1) && ~t1(2,2,2) && ~t2(1,1,1) && t2(2,2,2)); -4 tests, 4 passed, 0 known failure, 0 skipped -[inst/jones.m] ->>>>> /build/reproducible-path/octave-optics-0.1.4/inst/jones.m -***** error A = jones(); +[inst/zernike_noll_to_mn.m] +>>>>> /build/reproducible-path/octave-optics-0.1.4/inst/zernike_noll_to_mn.m ***** test - % test singular argument, should just be returned - M = jones_waveplate(rand(1,1),'wav'); - MM = jones(M); - R = MM-M; - assert(norm(R,inf), 0, 1e-9); + [m,n]=zernike_noll_to_mn(1); + assert([m n],[0 0]) ***** test - % send light with horizontal linear polarization through a rotating - % 1/2-waveplate and subsequent polarizer: final intensity should - % vary as cos(2*angle)^2. - % This test feeds jones() with one cell array only! - angles = 0:360; - wps = jones_rotate(jones_waveplate(0.5, 'wav'), angles, 'deg'); - lightin = jones_lphorizontal(); - lightout = jones(jones_linpolarizer(),wps,lightin); - ilightout = jones_intensity(lightout); - R = ilightout-(cosd(angles.*2).^2); - assert(norm(R,inf), 0, 1e-9); + [m,n]=zernike_noll_to_mn(2); + assert([m n],[1 1]) ***** test - % this is a more thorough test: send light with horizontal linear - % polarization through two rotating 1/2-waveplates (combining to - % a 1/1-waveplate) and subsequent polarizer: final intensity - % should not vary! - % This test feeds jones() with two cell arrays. - angles = 0:360; - wps1 = jones_rotate(jones_waveplate(0.5, 'wav'), angles, 'deg'); - wps2 = jones_rotate(jones_waveplate(0.5, 'wav'), angles, 'deg'); - lightin = jones_lphorizontal(); - lightout = jones(jones_linpolarizer(),wps2,wps1,lightin); - ilightout = jones_intensity(lightout); - R = ilightout-1; - assert(norm(R,inf), 0, 1e-9); -***** demo - angles = 0:360; - wps = jones_rotate(jones_waveplate(0.5, 'wav'), angles, 'deg'); - lightin = jones_lphorizontal(); - lightout = jones(jones_linpolarizer(),wps,lightin); - ilightout = jones_intensity(lightout); - figure(); - plot(angles, ilightout); - title('transmitted intensity [should look like cos(2*a)^2'); - xlabel('angle of halfwave plate axis'); - ylabel('intensity [a.u.]'); - legend('transmitted intensity'); - % ----------------------------------------------------------------- - % example 1: send light with horizontal linear polarization through - % a rotating, perfect halfwave plate and subsequent polarizer: - % final intensity should vary as cos(2*angle)^2. -***** demo - angles = 0:360; - wps = jones_rotate(jones_waveplate(0.5, 'wav'), angles, 'deg'); - wps2 = jones_rotate(jones_waveplate(0.45, 'wav'), angles, 'deg'); - lightin = jones_lphorizontal(); - lightout = jones(jones_linpolarizer(),wps,lightin); - ilightout = jones_intensity(lightout); - lightout2 = jones(jones_linpolarizer(),wps2,lightin); - ilightout2 = jones_intensity(lightout2); - figure(); - plot(angles, ilightout, angles, ilightout2); - title('transmitted intensity with perfect and non-perfect halfwave plate'); - xlabel('angle of halfwave plate axis'); - ylabel('intensity [a.u.]'); - legend('perfect (0.5-)plate', 'non-perfect (0.45-)plate'); - % ----------------------------------------------------------------- - % example 2: send light with horizontal linear polarization through - % a rotating, non-perfect halfwave plate and subsequent polarizer: - % final intensity should deviate from the perfect cos(2*angle)^2 - % curve, never reaching zero transmission -***** demo - angle = 0:360; - delay = 0:0.05:1; - % angles are in rows, delays in columns - angle_all = repmat(angle, [length(delay), 1]); - delay_all = repmat(delay', [1, length(angle)]); - wps3 = jones_waveplate(delay_all, 'wav'); - wps3 = jones_rotate(wps3, angle_all, 'deg'); - lightin = jones_lphorizontal(); - lightout3 = jones(jones_linpolarizer(),wps3,lightin); - ilightout3 = jones_intensity(lightout3); - figure(); - plot(angle, ilightout3); - title('transmitted intensity with plates of increasing delay'); - xlabel('angle of plate axis'); - ylabel('intensity [a.u.]'); - legend(cellfun(@(x)sprintf('delay=%.2f',x),num2cell(delay),'UniformOutput',false)); - % ----------------------------------------------------------------- - % example 3: send light with horizontal linear polarization through - % rotating waveplates with increasing delay and subsequent polarizer -4 tests, 4 passed, 0 known failure, 0 skipped -[inst/mueller_depolarizer.m] ->>>>> /build/reproducible-path/octave-optics-0.1.4/inst/mueller_depolarizer.m + [m,n]=zernike_noll_to_mn(3); + assert([m n],[-1 1]) ***** test - % test default return value - A = mueller_depolarizer(); - R = A*A-A; - assert(norm(R,inf), 0, 1e-9); - + [m,n]=zernike_noll_to_mn(4); + assert([m n],[0 2]) ***** test - % test serial application of matrix - depolarization = rand(1, 1); - A1 = mueller_depolarizer(depolarization); - A2 = mueller_depolarizer(depolarization^2); - R = A1*A1-A2; - assert(norm(R,inf), 0, 1e-9); - + [m,n]=zernike_noll_to_mn(5); + assert([m n],[-2 2]) ***** test - % another test of serial application - depolarization1 = rand(1, 1); - depolarization2 = rand(1, 1); - A1 = mueller_depolarizer(depolarization1); - A2 = mueller_depolarizer(depolarization2); - A12 = mueller_depolarizer(depolarization1*depolarization2); - R = A1*A2-A12; - assert(norm(R,inf), 0, 1e-9); - + [m,n]=zernike_noll_to_mn(20); + assert([m n],[5 5]) ***** test - % test size of return value - for dim = 1:5 - asize = randi([1 4], 1, dim); - R = rand(asize); - if numel(R) == 1 - R = {R}; - end - rsize = size(R); - C = mueller_depolarizer(R); - csize = size(C); - assert(rsize == csize); - end -4 tests, 4 passed, 0 known failure, 0 skipped -[inst/mueller_unity.m] ->>>>> /build/reproducible-path/octave-optics-0.1.4/inst/mueller_unity.m + [m,n]=zernike_noll_to_mn(34); + assert([m n],[5 7]) ***** test - A = mueller_unity(); - R = A*A-A; - assert(norm(R,inf), 0, 1e-9); - + [m,n]=zernike_noll_to_mn(35); + assert([m n],[-7 7]) ***** test - for dim = 1:5 - asize = randi([1 4], 1, dim); - C = cell(asize); - csize = size(C); - U = mueller_unity(C); - usize = size(U); - assert(usize == csize); - end - + [m,n]=zernike_noll_to_mn(36); + assert([m n],[7 7]) ***** test - for dim = 1:5 - asize = randi([1 4], 1, dim); - rsize = size(rand(asize)); - U = mueller_unity(rsize); - usize = size(U); - assert(usize == rsize); - end -3 tests, 3 passed, 0 known failure, 0 skipped -[inst/mueller_linretarder.m] ->>>>> /build/reproducible-path/octave-optics-0.1.4/inst/mueller_linretarder.m + [m,n]=zernike_noll_to_mn([2 5 8 35]); + assert(m,[1 -2 1 -7]) + assert(n,[1 2 3 7]) +10 tests, 10 passed, 0 known failure, 0 skipped +[inst/jones_rotator.m] +>>>>> /build/reproducible-path/octave-optics-0.1.4/inst/jones_rotator.m ***** test % test default return value - A = mueller_linretarder(); + A = jones_rotator(); R = A*A-A; assert(norm(R,inf), 0, 1e-9); ***** test - % test serial application of linear retarder elements - phase = rand(1, 1); - A1 = mueller_linretarder(phase); - A2 = mueller_linretarder(phase*2); + % test serial application of rotator + angle = rand(1, 1); + A1 = jones_rotator(angle); + A2 = jones_rotator(angle*2); R = A1*A1-A2; assert(norm(R,inf), 0, 1e-9); ***** test - % another test of serial application of retarder elements - phase1 = rand(1, 1); - phase2 = rand(1, 1); - A1 = mueller_linretarder(phase1); - A2 = mueller_linretarder(phase2); - A12 = mueller_linretarder(phase1+phase2); + % another test of serial application of rotator + angle1 = rand(1, 1); + angle2 = rand(1, 1); + A1 = jones_rotator(angle1); + A2 = jones_rotator(angle2); + A12 = jones_rotator(angle1+angle2); R = A1*A2-A12; assert(norm(R,inf), 0, 1e-9); ***** test - % test mode - phase = rand(1, 1); - A1 = mueller_linretarder(phase); - A2 = mueller_linretarder(phase*180/pi(), 'deg'); - A3 = mueller_linretarder(phase/(2*pi()), 'wav'); - R1 = A1-A2; - R2 = A1-A3; - assert(norm(R1,inf)+norm(R2,inf), 0, 1e-9); + % test different angle value interpretations + angle = rand(1, 1); + A1 = jones_rotator(angle); + A2 = jones_rotator(-angle*180/pi(), 'deg'); + R = A2*A1-jones_unity(); + assert(norm(R,inf), 0, 1e-9); ***** test - % test correct size of return values + % test size of return values for dim = 1:5 asize = randi([1 4], 1, dim); R = rand(asize); @@ -5584,62 +5767,38 @@ R = {R}; end rsize = size(R); - C = mueller_linretarder(R); + C = jones_rotator(R); csize = size(C); assert(rsize == csize); end 5 tests, 5 passed, 0 known failure, 0 skipped -[inst/mueller_circdiattenuator.m] ->>>>> /build/reproducible-path/octave-optics-0.1.4/inst/mueller_circdiattenuator.m +[inst/mueller_waveplate.m] +>>>>> /build/reproducible-path/octave-optics-0.1.4/inst/mueller_waveplate.m ***** test % test default return value - A = mueller_circdiattenuator(); + A = mueller_waveplate(); R = A*A-A; assert(norm(R,inf), 0, 1e-9); ***** test - % test equality of providing diattenuation or kx and ky - d = rand(1, 1); - kr = 1; - kl = (1-d)./(1+d); - A1 = mueller_circdiattenuator(d); - A2 = mueller_circdiattenuator(kr, kl); - R = A1-A2; - assert(norm(R,inf), 0, 1e-9); - -***** test - % test serial application of circular diattenuators - kr = rand(1, 1); - kl = rand(1, 1); - A1 = mueller_circdiattenuator(kr,kl); - A2 = mueller_circdiattenuator(kr*kr,kl*kl); + % test serial application of absorptive elements + delay = rand(1, 1); + A1 = mueller_waveplate(delay); + A2 = mueller_waveplate(delay*2); R = A1*A1-A2; assert(norm(R,inf), 0, 1e-9); ***** test - % another test of serial application of retarder elements - kr1 = rand(1, 1); - kr2 = rand(1, 1); - kl1 = rand(1, 1); - kl2 = rand(1, 1); - A1 = mueller_circdiattenuator(kr1,kl1); - A2 = mueller_circdiattenuator(kr2,kl2); - A12 = mueller_circdiattenuator(kr1*kr2,kl1*kl2); + % another test of serial application of absorptive elements + delay1 = rand(1, 1); + delay2 = rand(1, 1); + A1 = mueller_waveplate(delay1); + A2 = mueller_waveplate(delay2); + A12 = mueller_waveplate(delay1+delay2); R = A1*A2-A12; assert(norm(R,inf), 0, 1e-9); ***** test - % test mode - kr = rand(1, 1); - kl = rand(1, 1); - A1 = mueller_circdiattenuator(kr,kl); - A2 = mueller_circdiattenuator(kr,kl,'int'); - A3 = mueller_circdiattenuator(sqrt(kr),sqrt(kl),'amp'); - R1 = A1-A2; - R2 = A1-A3; - assert(norm(R1,inf)+norm(R2,inf), 0, 1e-9); - -***** test % test correct size of return values for dim = 1:5 asize = randi([1 4], 1, dim); @@ -5648,117 +5807,39 @@ R = {R}; end rsize = size(R); - C = mueller_circdiattenuator(R); + C = mueller_waveplate(R); csize = size(C); assert(rsize == csize); end - -***** test - % another test correct size of return values - kr = rand(3,4,5); - kl = rand(5,4,3); - C = mueller_circdiattenuator(kr,kl); - csize = size(C); - assert(csize == [5,4,5]); -7 tests, 7 passed, 0 known failure, 0 skipped -[inst/stokes_isstokes.m] ->>>>> /build/reproducible-path/octave-optics-0.1.4/inst/stokes_isstokes.m -***** test - % test type check - V1 = stokes_unpolarized(); - V2 = char(V1); - t1 = stokes_isstokes(V1); - t2 = stokes_isstokes(V2); - assert(t1 && ~t2); - -***** test - % test size check - V1 = stokes_unpolarized(); - V2 = V1; - V2(5,1) = 1; - t1 = stokes_isstokes(V1); - t2 = stokes_isstokes(V2); - assert(t1 && ~t2); - -***** test - % test size of return value - V1 = stokes_unpolarized(ones(2,3,4)); - V1{2,2,2} = 0; - V2 = stokes_unpolarized(ones(4,3,2)); - V2{1,1,1} = 0; - t1 = stokes_isstokes(V1); - t2 = stokes_isstokes(V2); - assert((size(t1)==size(V1)) && (size(t2)==size(V2))); - -***** test - % test size of return value - V1 = stokes_unpolarized(ones(2,3,4)); - V2 = stokes_unpolarized(1); - [t1,t2] = stokes_isstokes(V1,V2); - assert((size(t1)==size(V1)) && (size(t2)==[1,1])); - -***** test - % test indivial elements of return value - V1 = stokes_unpolarized(ones(2,3,4)); - V1{2,2,2} = 0; - V2 = stokes_unpolarized(ones(4,3,2)); - V2{1,1,1} = 0; - t1 = stokes_isstokes(V1); - t2 = stokes_isstokes(V2); - assert(t1(1,1,1) && ~t1(2,2,2) && ~t2(1,1,1) && t2(2,2,2)); -5 tests, 5 passed, 0 known failure, 0 skipped -[inst/jones_lindiattenuator.m] ->>>>> /build/reproducible-path/octave-optics-0.1.4/inst/jones_lindiattenuator.m +4 tests, 4 passed, 0 known failure, 0 skipped +[inst/mueller_depolarizer.m] +>>>>> /build/reproducible-path/octave-optics-0.1.4/inst/mueller_depolarizer.m ***** test % test default return value - A = jones_lindiattenuator(); + A = mueller_depolarizer(); R = A*A-A; assert(norm(R,inf), 0, 1e-9); ***** test - % test equality of providing diattenuation or kx and ky - d = rand(1, 1); - kx = 1; - ky = (1-d)./(1+d); - A1 = jones_lindiattenuator(d); - A2 = jones_lindiattenuator(kx, ky); - R = A1-A2; - assert(norm(R,inf), 0, 1e-9); - -***** test - % test serial application of linear diattenuators - kx = rand(1, 1); - ky = rand(1, 1); - A1 = jones_lindiattenuator(kx,ky); - A2 = jones_lindiattenuator(kx*kx,ky*ky); + % test serial application of matrix + depolarization = rand(1, 1); + A1 = mueller_depolarizer(depolarization); + A2 = mueller_depolarizer(depolarization^2); R = A1*A1-A2; assert(norm(R,inf), 0, 1e-9); ***** test - % another test of serial application of retarder elements - kx1 = rand(1, 1); - kx2 = rand(1, 1); - ky1 = rand(1, 1); - ky2 = rand(1, 1); - A1 = jones_lindiattenuator(kx1,ky1); - A2 = jones_lindiattenuator(kx2,ky2); - A12 = jones_lindiattenuator(kx1*kx2,ky1*ky2); + % another test of serial application + depolarization1 = rand(1, 1); + depolarization2 = rand(1, 1); + A1 = mueller_depolarizer(depolarization1); + A2 = mueller_depolarizer(depolarization2); + A12 = mueller_depolarizer(depolarization1*depolarization2); R = A1*A2-A12; assert(norm(R,inf), 0, 1e-9); ***** test - % test mode - kx = rand(1, 1); - ky = rand(1, 1); - A1 = jones_lindiattenuator(kx,ky); - A2 = jones_lindiattenuator(kx,ky,'int'); - A3 = jones_lindiattenuator(sqrt(kx),sqrt(ky),'amp'); - R1 = A1-A2; - R2 = A1-A3; - assert(norm(R1,inf)+norm(R2,inf), 0, 1e-9); - -***** test - % test correct size of return values + % test size of return value for dim = 1:5 asize = randi([1 4], 1, dim); R = rand(asize); @@ -5766,32 +5847,24 @@ R = {R}; end rsize = size(R); - C = jones_lindiattenuator(R); + C = mueller_depolarizer(R); csize = size(C); assert(rsize == csize); end - -***** test - % another test correct size of return values - kx = rand(3,4,5); - ky = rand(5,4,3); - C = jones_lindiattenuator(kx,ky); - csize = size(C); - assert(csize == [5,4,5]); -7 tests, 7 passed, 0 known failure, 0 skipped -[inst/jones_cpright.m] ->>>>> /build/reproducible-path/octave-optics-0.1.4/inst/jones_cpright.m +4 tests, 4 passed, 0 known failure, 0 skipped +[inst/jones_lphorizontal.m] +>>>>> /build/reproducible-path/octave-optics-0.1.4/inst/jones_lphorizontal.m ***** test % test default return value - V = jones_cpright(); - R = V-[1;1i]; + V = jones_lphorizontal(); + R = V-[1;0]; assert(norm(R,inf), 0, 1e-9); ***** test % test return value amplitude = rand(1, 1); - V = jones_cpright(amplitude); - R = V-[1;1i]*amplitude; + V = jones_lphorizontal(amplitude); + R = V-[1;0]*amplitude; assert(norm(R,inf), 0, 1e-9); ***** test @@ -5803,48 +5876,11 @@ R = {R}; end rsize = size(R); - C = jones_cpright(R); + C = jones_lphorizontal(R); csize = size(C); assert(rsize == csize); end 3 tests, 3 passed, 0 known failure, 0 skipped -[inst/jones_waveplate.m] ->>>>> /build/reproducible-path/octave-optics-0.1.4/inst/jones_waveplate.m -***** test - % test default return value - A = jones_waveplate(); - R = A*A-A; - assert(norm(R,inf), 0, 1e-9); -***** test - % test serial application of absorptive elements - delay = rand(1, 1); - A1 = jones_waveplate(delay); - A2 = jones_waveplate(delay*2); - R = A1*A1-A2; - assert(norm(R,inf), 0, 1e-9); -***** test - % another test of serial application of absorptive elements - delay1 = rand(1, 1); - delay2 = rand(1, 1); - A1 = jones_waveplate(delay1); - A2 = jones_waveplate(delay2); - A12 = jones_waveplate(delay1+delay2); - R = A1*A2-A12; - assert(norm(R,inf), 0, 1e-9); -***** test - % test correct size of return values - for dim = 1:5 - asize = randi([1 4], 1, dim); - R = rand(asize); - if numel(R) == 1 - R = {R}; - end - rsize = size(R); - C = jones_waveplate(R); - csize = size(C); - assert(csize, rsize); - end -4 tests, 4 passed, 0 known failure, 0 skipped Checking C++ files ... Done running the unit tests. Summary: 207 tests, 207 passed, 0 known failures, 0 skipped @@ -5873,12 +5909,14 @@ dpkg-buildpackage: info: binary-only upload (no source included) dpkg-genchanges: info: not including original source code in upload I: copying local configuration +I: user script /srv/workspace/pbuilder/1104808/tmp/hooks/B01_cleanup starting +I: user script /srv/workspace/pbuilder/1104808/tmp/hooks/B01_cleanup finished I: unmounting dev/ptmx filesystem I: unmounting dev/pts filesystem I: unmounting dev/shm filesystem I: unmounting proc filesystem I: unmounting sys filesystem I: cleaning the build env -I: removing directory /srv/workspace/pbuilder/4139765 and its subdirectories -I: Current time: Fri Nov 15 06:57:46 -12 2024 -I: pbuilder-time-stamp: 1731697066 +I: removing directory /srv/workspace/pbuilder/1104808 and its subdirectories +I: Current time: Fri Dec 19 15:26:23 +14 2025 +I: pbuilder-time-stamp: 1766107583