Diff of the two buildlogs: -- --- b1/build.log 2024-11-25 14:34:42.831226461 +0000 +++ b2/build.log 2024-11-25 14:37:09.224790564 +0000 @@ -1,6 +1,6 @@ I: pbuilder: network access will be disabled during build -I: Current time: Mon Nov 25 02:29:58 -12 2024 -I: pbuilder-time-stamp: 1732544998 +I: Current time: Mon Dec 29 10:57:45 +14 2025 +I: pbuilder-time-stamp: 1766955465 I: Building the build Environment I: extracting base tarball [/var/cache/pbuilder/trixie-reproducible-base.tgz] I: copying local configuration @@ -27,53 +27,85 @@ 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/22190/tmp/hooks/D02_print_environment starting +I: user script /srv/workspace/pbuilder/29575/tmp/hooks/D01_modify_environment starting +debug: Running on infom08-i386. +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 28 20:57 /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/29575/tmp/hooks/D01_modify_environment finished +I: user script /srv/workspace/pbuilder/29575/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='i386' - DEBIAN_FRONTEND='noninteractive' - DEB_BUILD_OPTIONS='buildinfo=+all reproducible=+all parallel=6 ' - DISTRIBUTION='trixie' - HOME='/root' - HOST_ARCH='i386' + 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]="i686-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=i386 + DEBIAN_FRONTEND=noninteractive + DEB_BUILD_OPTIONS='buildinfo=+all reproducible=+all parallel=5 ' + DIRSTACK=() + DISTRIBUTION=trixie + EUID=0 + FUNCNAME=([0]="Echo" [1]="main") + GROUPS=() + HOME=/root + HOSTNAME=i-capture-the-hostname + HOSTTYPE=i686 + HOST_ARCH=i386 IFS=' ' - INVOCATION_ID='e7c5a730d19148579cd48bf28d000d9e' - LANG='C' - LANGUAGE='en_US:en' - LC_ALL='C' - LD_LIBRARY_PATH='/usr/lib/libeatmydata' - LD_PRELOAD='libeatmydata.so' - 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='22190' - PS1='# ' - PS2='> ' + INVOCATION_ID=be79ca7c97514c8d85096184f8cb3b82 + LANG=C + LANGUAGE=de_CH:de + LC_ALL=C + LD_LIBRARY_PATH=/usr/lib/libeatmydata + LD_PRELOAD=libeatmydata.so + MACHTYPE=i686-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=29575 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.U9rJ6c8P/pbuilderrc_zehr --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.U9rJ6c8P/b1 --logfile b1/build.log octave-optics_0.1.4-4.dsc' - SUDO_GID='111' - 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.U9rJ6c8P/pbuilderrc_Y9Pw --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.U9rJ6c8P/b2 --logfile b2/build.log octave-optics_0.1.4-4.dsc' + SUDO_GID=111 + 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 infom07-i386 6.1.0-28-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.119-1 (2024-11-22) x86_64 GNU/Linux + Linux i-capture-the-hostname 6.11.5+bpo-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.11.5-1~bpo12+1 (2024-11-11) 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/22190/tmp/hooks/D02_print_environment finished + lrwxrwxrwx 1 root root 7 Aug 4 2024 /bin -> usr/bin +I: user script /srv/workspace/pbuilder/29575/tmp/hooks/D02_print_environment finished -> Attempting to satisfy build-dependencies -> Creating pbuilder-satisfydepends-dummy package Package: pbuilder-satisfydepends-dummy @@ -681,7 +713,7 @@ Get: 562 http://deb.debian.org/debian trixie/main i386 texlive-latex-recommended all 2024.20241115-1 [8757 kB] Get: 563 http://deb.debian.org/debian trixie/main i386 texlive-pictures all 2024.20241115-1 [17.0 MB] Get: 564 http://deb.debian.org/debian trixie/main i386 texlive-latex-extra all 2024.20241115-1 [24.6 MB] -Fetched 317 MB in 3s (102 MB/s) +Fetched 317 MB in 6s (56.3 MB/s) debconf: delaying package configuration, since apt-utils is not installed Selecting previously unselected package libpython3.12-minimal:i386. (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 ... 19956 files and directories currently installed.) @@ -2522,8 +2554,8 @@ Setting up tzdata (2024b-3) ... Current default time zone: 'Etc/UTC' -Local time is now: Mon Nov 25 14:31:40 UTC 2024. -Universal Time is now: Mon Nov 25 14:31:40 UTC 2024. +Local time is now: Sun Dec 28 20:58:35 UTC 2025. +Universal Time is now: Sun Dec 28 20:58:35 UTC 2025. Run 'dpkg-reconfigure tzdata' if you wish to change it. Setting up libxcb-present0:i386 (1.17.0-2+b1) ... @@ -3016,7 +3048,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/29575/tmp/hooks/A99_set_merged_usr starting +Not re-configuring usrmerge for trixie +I: user script /srv/workspace/pbuilder/29575/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 @@ -3885,34 +3921,64 @@ Checking package... Run the unit tests... Checking m files ... -[inst/mueller_depolarizer.m] ->>>>> /build/reproducible-path/octave-optics-0.1.4/inst/mueller_depolarizer.m +[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/mueller_absorber.m] +>>>>> /build/reproducible-path/octave-optics-0.1.4/inst/mueller_absorber.m ***** test % test default return value - A = mueller_depolarizer(); + A = mueller_absorber(); R = A*A-A; assert(norm(R,inf), 0, 1e-9); ***** test - % test serial application of matrix - depolarization = rand(1, 1); - A1 = mueller_depolarizer(depolarization); - A2 = mueller_depolarizer(depolarization^2); + % 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 application - depolarization1 = rand(1, 1); - depolarization2 = rand(1, 1); - A1 = mueller_depolarizer(depolarization1); - A2 = mueller_depolarizer(depolarization2); - A12 = mueller_depolarizer(depolarization1*depolarization2); + % 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 - % test size of return value + % test correct size of return values for dim = 1:5 asize = randi([1 4], 1, dim); R = rand(asize); @@ -3920,87 +3986,27 @@ R = {R}; end rsize = size(R); - C = mueller_depolarizer(R); + C = mueller_absorber(R); csize = size(C); assert(rsize == csize); end 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/mueller_circdiattenuator.m] ->>>>> /build/reproducible-path/octave-optics-0.1.4/inst/mueller_circdiattenuator.m +[inst/jones_cpright.m] +>>>>> /build/reproducible-path/octave-optics-0.1.4/inst/jones_cpright.m ***** test % test default return value - A = mueller_circdiattenuator(); - 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); - R = A1*A1-A2; + V = jones_cpright(); + R = V-[1;1i]; 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; + % 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 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); @@ -4009,25 +4015,18 @@ R = {R}; end rsize = size(R); - C = mueller_circdiattenuator(R); + C = jones_cpright(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/jones_mirror.m] ->>>>> /build/reproducible-path/octave-optics-0.1.4/inst/jones_mirror.m +3 tests, 3 passed, 0 known failure, 0 skipped +[inst/mueller_linpolarizer.m] +>>>>> /build/reproducible-path/octave-optics-0.1.4/inst/mueller_linpolarizer.m ***** test - % test mirror that is its own inverted element - A = jones_mirror(); - R = (A-1\A); + % 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 @@ -4035,7 +4034,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 @@ -4046,16 +4045,16 @@ 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/mueller_unity.m] ->>>>> /build/reproducible-path/octave-optics-0.1.4/inst/mueller_unity.m +[inst/jones_unity.m] +>>>>> /build/reproducible-path/octave-optics-0.1.4/inst/jones_unity.m ***** test - A = mueller_unity(); + A = jones_unity(); R = A*A-A; assert(norm(R,inf), 0, 1e-9); @@ -4064,7 +4063,7 @@ asize = randi([1 4], 1, dim); C = cell(asize); csize = size(C); - U = mueller_unity(C); + U = jones_unity(C); usize = size(U); assert(usize == csize); end @@ -4073,27 +4072,62 @@ for dim = 1:5 asize = randi([1 4], 1, dim); rsize = size(rand(asize)); - U = mueller_unity(rsize); + U = jones_unity(rsize); usize = size(U); assert(usize == rsize); 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/mueller_circdiattenuator.m] +>>>>> /build/reproducible-path/octave-optics-0.1.4/inst/mueller_circdiattenuator.m ***** test % test default return value - V = jones_cpleft(); - R = V-[1;-1i]; + A = mueller_circdiattenuator(); + R = A*A-A; assert(norm(R,inf), 0, 1e-9); ***** test - % test return value - amplitude = rand(1, 1); - V = jones_cpleft(amplitude); - R = V-[1;-1i]*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); @@ -4102,24 +4136,53 @@ R = {R}; end rsize = size(R); - C = jones_cpleft(R); + C = mueller_circdiattenuator(R); csize = size(C); assert(rsize == csize); 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 + +***** 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_intensity.m] +>>>>> /build/reproducible-path/octave-optics-0.1.4/inst/stokes_intensity.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)); + +***** 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/jones_linretarder.m] +>>>>> /build/reproducible-path/octave-optics-0.1.4/inst/jones_linretarder.m ***** test % test default return value - A = mueller_linretarder(); + A = jones_linretarder(); 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); + A1 = jones_linretarder(phase); + A2 = jones_linretarder(phase*2); R = A1*A1-A2; assert(norm(R,inf), 0, 1e-9); @@ -4127,18 +4190,18 @@ % 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); + 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_linretarder(phase); - A2 = mueller_linretarder(phase*180/pi(), 'deg'); - A3 = mueller_linretarder(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); @@ -4152,78 +4215,39 @@ R = {R}; end rsize = size(R); - C = mueller_linretarder(R); + C = jones_linretarder(R); csize = size(C); assert(rsize == csize); end 5 tests, 5 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/mueller_rotator.m] ->>>>> /build/reproducible-path/octave-optics-0.1.4/inst/mueller_rotator.m +[inst/mueller_depolarizer.m] +>>>>> /build/reproducible-path/octave-optics-0.1.4/inst/mueller_depolarizer.m ***** test % test default return value - A = mueller_rotator(); + A = mueller_depolarizer(); R = A*A-A; assert(norm(R,inf), 0, 1e-9); ***** test - % test serial application of rotator - angle = rand(1, 1); - A1 = mueller_rotator(angle); - A2 = mueller_rotator(angle*2); + % 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 rotator - angle1 = rand(1, 1); - angle2 = rand(1, 1); - A1 = mueller_rotator(angle1); - A2 = mueller_rotator(angle2); - A12 = mueller_rotator(angle1+angle2); + % 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 different angle value interpretations - angle = rand(1, 1); - A1 = mueller_rotator(angle); - A2 = mueller_rotator(-angle*180/pi(), 'deg'); - R = A2*A1-mueller_unity(); - assert(norm(R,inf), 0, 1e-9); - -***** test - % test size of return values + % test size of return value for dim = 1:5 asize = randi([1 4], 1, dim); R = rand(asize); @@ -4231,52 +4255,52 @@ R = {R}; end rsize = size(R); - C = mueller_rotator(R); + C = mueller_depolarizer(R); csize = size(C); assert(rsize == csize); end -5 tests, 5 passed, 0 known failure, 0 skipped -[inst/jones.m] ->>>>> /build/reproducible-path/octave-optics-0.1.4/inst/jones.m -***** error A = jones(); +4 tests, 4 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(); ***** test % test singular argument, should just be returned - M = jones_waveplate(rand(1,1),'wav'); - MM = jones(M); + M = mueller_waveplate(rand(1,1),'wav'); + MM = mueller_stokes(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! + % This test feeds mueller_stokes() 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); + wps = mueller_rotate(mueller_waveplate(0.5, 'wav'), angles, 'deg'); + lightin = stokes_lphorizontal(); + lightout = mueller_stokes(mueller_linpolarizer(),wps,lightin); + ilightout = stokes_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. + % should not vary! + % This test feeds mueller_stokes() 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); + wps1 = mueller_rotate(mueller_waveplate(0.5, 'wav'), angles, 'deg'); + wps2 = mueller_rotate(mueller_waveplate(0.5, 'wav'), angles, 'deg'); + lightin = stokes_lphorizontal(); + lightout = mueller_stokes(mueller_linpolarizer(),wps2,wps1,lightin); + ilightout = stokes_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); + wps = mueller_rotate(mueller_waveplate(0.5, 'wav'), angles, 'deg'); + lightin = stokes_lphorizontal(); + lightout = mueller_stokes(mueller_linpolarizer(),wps,lightin); + ilightout = stokes_intensity(lightout); figure(); plot(angles, ilightout); title('transmitted intensity [should look like cos(2*a)^2'); @@ -4289,13 +4313,13 @@ % 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); + wps = mueller_rotate(mueller_waveplate(0.5, 'wav'), angles, 'deg'); + wps2 = mueller_rotate(mueller_waveplate(0.45, 'wav'), angles, 'deg'); + lightin = stokes_lphorizontal(); + lightout = mueller_stokes(mueller_linpolarizer(),wps,lightin); + ilightout = stokes_intensity(lightout); + lightout2 = mueller_stokes(mueller_linpolarizer(),wps2,lightin); + ilightout2 = stokes_intensity(lightout2); figure(); plot(angles, ilightout, angles, ilightout2); title('transmitted intensity with perfect and non-perfect halfwave plate'); @@ -4313,11 +4337,11 @@ % 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); + wps3 = mueller_waveplate(delay_all, 'wav'); + wps3 = mueller_rotate(wps3, angle_all, 'deg'); + lightin = stokes_lphorizontal(); + lightout3 = mueller_stokes(mueller_linpolarizer(),wps3,lightin); + ilightout3 = stokes_intensity(lightout3); figure(); plot(angle, ilightout3); title('transmitted intensity with plates of increasing delay'); @@ -4326,12 +4350,12 @@ 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 + % rotating waveplates with increasing delay and subsequent polarizer 4 tests, 4 passed, 0 known failure, 0 skipped -[inst/jones_unity.m] ->>>>> /build/reproducible-path/octave-optics-0.1.4/inst/jones_unity.m +[inst/mueller_unity.m] +>>>>> /build/reproducible-path/octave-optics-0.1.4/inst/mueller_unity.m ***** test - A = jones_unity(); + A = mueller_unity(); R = A*A-A; assert(norm(R,inf), 0, 1e-9); @@ -4340,7 +4364,7 @@ asize = randi([1 4], 1, dim); C = cell(asize); csize = size(C); - U = jones_unity(C); + U = mueller_unity(C); usize = size(U); assert(usize == csize); end @@ -4349,24 +4373,24 @@ for dim = 1:5 asize = randi([1 4], 1, dim); rsize = size(rand(asize)); - U = jones_unity(rsize); + U = mueller_unity(rsize); usize = size(U); assert(usize == rsize); 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 +[inst/stokes_lphorizontal.m] +>>>>> /build/reproducible-path/octave-optics-0.1.4/inst/stokes_lphorizontal.m ***** test % test default return value - V = stokes_lpvertical(); - R = V-[1;-1;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_lpvertical(intensity); - R = V-[1;-1;0;0]*intensity; + V = stokes_lphorizontal(intensity); + R = V-[1;1;0;0]*intensity; assert(norm(R,inf), 0, 1e-9); ***** test @@ -4378,96 +4402,24 @@ R = {R}; end rsize = size(R); - C = stokes_lpvertical(R); + C = stokes_lphorizontal(R); csize = size(C); assert(rsize == csize); end 3 tests, 3 passed, 0 known failure, 0 skipped -[inst/jones_lindiattenuator.m] ->>>>> /build/reproducible-path/octave-optics-0.1.4/inst/jones_lindiattenuator.m -***** test - % test default return value - A = jones_lindiattenuator(); - 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); - 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); - 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 - 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_lindiattenuator(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/stokes_cpright.m] ->>>>> /build/reproducible-path/octave-optics-0.1.4/inst/stokes_cpright.m +[inst/stokes_lpplus45.m] +>>>>> /build/reproducible-path/octave-optics-0.1.4/inst/stokes_lpplus45.m ***** test % test default return value - V = stokes_cpright(); - R = V-[1;0;0;1]; + 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_cpright(intensity); - R = V-[1;0;0;1]*intensity; + V = stokes_lpplus45(intensity); + R = V-[1;0;1;0]*intensity; assert(norm(R,inf), 0, 1e-9); ***** test @@ -4479,113 +4431,65 @@ R = {R}; end rsize = size(R); - C = stokes_cpright(R); + C = stokes_lpplus45(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 +[inst/jones_linpolarizer.m] +>>>>> /build/reproducible-path/octave-optics-0.1.4/inst/jones_linpolarizer.m ***** test - % test default return value - A = mueller_homogeneous_elliptic_diattenuator(); + % applying an ideal linear polarizer twice is identical to + % apply it once! + A = jones_linpolarizer(); R = A*A-A; assert(norm(R,inf), 0, 1e-9); ***** test - % test modes - t0 = rand(1,1); - d = rand(1,1); - azimuth = rand(1,1); - ellipticity = rand(1,1); - A1 = mueller_homogeneous_elliptic_diattenuator(t0,d,azimuth,ellipticity); - A2 = mueller_homogeneous_elliptic_diattenuator(t0,d,azimuth*180/pi(),ellipticity,'deg'); - R = (A2-A1); - assert(norm(R,inf), 0, 1e-9); - -***** test - % another test correct size of return values - t0 = rand(3,4,5); - d = rand(4,5,6); - azimuth = rand(5,4,3); - ellipticity = rand(6,5,4); - C = mueller_homogeneous_elliptic_diattenuator(t0,d,azimuth,ellipticity); - csize = size(C); - assert(csize == [6,5,6]); -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_lphorizontal(); - R = V-[1;1;0;0]; - 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; - assert(norm(R,inf), 0, 1e-9); - -***** test - % test correct size of return values + % test direct size parameter 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_lphorizontal(R); - csize = size(C); - assert(rsize == csize); + rsize = size(rand(asize)); + U = jones_linpolarizer(rsize); + usize = size(U); + assert(usize == rsize); end -3 tests, 3 passed, 0 known failure, 0 skipped -[inst/stokes_unpolarized.m] ->>>>> /build/reproducible-path/octave-optics-0.1.4/inst/stokes_unpolarized.m -***** test - % test default return value - 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_unpolarized(intensity); - R = V-[1;0;0;0]*intensity; - assert(norm(R,inf), 0, 1e-9); - -***** test - % test correct size of return values + % test indirect size parameter 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_unpolarized(R); + C = cell(asize); csize = size(C); - assert(rsize == csize); + U = jones_linpolarizer(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_waveplate.m] +>>>>> /build/reproducible-path/octave-optics-0.1.4/inst/jones_waveplate.m ***** test % test default return value - V = jones_lpplus45(); - R = V-[1;1]; + A = jones_waveplate(); + 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; + % 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 @@ -4595,11 +4499,11 @@ R = {R}; end rsize = size(R); - C = jones_lpplus45(R); + C = jones_waveplate(R); csize = size(C); - assert(rsize == csize); + assert(csize, rsize); end -3 tests, 3 passed, 0 known failure, 0 skipped +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 ***** test @@ -4629,19 +4533,19 @@ assert(rsize == csize); end 3 tests, 3 passed, 0 known failure, 0 skipped -[inst/jones_cpright.m] ->>>>> /build/reproducible-path/octave-optics-0.1.4/inst/jones_cpright.m +[inst/stokes_lpvertical.m] +>>>>> /build/reproducible-path/octave-optics-0.1.4/inst/stokes_lpvertical.m ***** test % test default return value - V = jones_cpright(); - R = V-[1;1i]; + V = stokes_lpvertical(); + R = V-[1;-1;0;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; + intensity = rand(1, 1); + V = stokes_lpvertical(intensity); + R = V-[1;-1;0;0]*intensity; assert(norm(R,inf), 0, 1e-9); ***** test @@ -4653,83 +4557,60 @@ R = {R}; end rsize = size(R); - C = jones_cpright(R); + C = stokes_lpvertical(R); csize = size(C); assert(rsize == 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 -***** test - % test default return value - A = jones_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); - R = A1*A1-A2; - assert(norm(R,inf), 0, 1e-9); - -***** test - % 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); - +[inst/jones_intensity.m] +>>>>> /build/reproducible-path/octave-optics-0.1.4/inst/jones_intensity.m ***** 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(); - assert(norm(R,inf), 0, 1e-9); + % 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 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_rotator(R); - csize = size(C); - assert(rsize == csize); - end -5 tests, 5 passed, 0 known failure, 0 skipped -[inst/mueller_rotate.m] ->>>>> /build/reproducible-path/octave-optics-0.1.4/inst/mueller_rotate.m + % 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/jones_rotate.m] +>>>>> /build/reproducible-path/octave-optics-0.1.4/inst/jones_rotate.m ***** test % default return value: unity matrix - A = mueller_rotate(); + 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); - M = mueller_linretarder(delay); - A = mueller_rotate(M, 0); - R = M-A; + 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); - M = mueller_linretarder(delay); - A1 = mueller_rotate(M, angle); - A2 = mueller_rotate(A1, -angle); - R = A2-M; + 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 @@ -4737,18 +4618,18 @@ 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); + 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 = mueller_rotate(mueller_waveplate(0.5), angle, 'rad'); - A2 = mueller_rotate(mueller_waveplate(0.5), angle*180/pi(), 'deg'); + 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); @@ -4758,7 +4639,7 @@ for dim = 1:5 asize = randi([1 4], 1, dim); rsize = size(rand(asize)); - C = mueller_rotate(mueller_unity(rsize), angle); + C = jones_rotate(jones_unity(rsize), angle); csize = size(C); assert(rsize == csize); end @@ -4772,97 +4653,70 @@ R = {R}; end rsize = size(R); - C = mueller_rotate(mueller_unity(), R); + C = jones_rotate(jones_unity(), R); csize = size(C); assert(rsize == csize); end ***** test % size if return value determined by both argument - M = mueller_unity([4,3,2]); + JM = jones_unity([4,3,2]); angle = rand(2,3,4); - C = mueller_rotate(M, angle); + C = jones_rotate(JM, angle); csize = size(C); assert(csize == [4,3,4]); 8 tests, 8 passed, 0 known failure, 0 skipped -[inst/mueller_absorber.m] ->>>>> /build/reproducible-path/octave-optics-0.1.4/inst/mueller_absorber.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/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_absorber(); + A = mueller_homogeneous_elliptic_retarder(); 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); - 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; + % 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 - % 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 = mueller_absorber(R); - csize = size(C); - assert(rsize == csize); - end -4 tests, 4 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 + % 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/mueller_circretarder.m] >>>>> /build/reproducible-path/octave-optics-0.1.4/inst/mueller_circretarder.m ***** test @@ -4913,89 +4767,52 @@ 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 -[inst/mueller_waveplate.m] ->>>>> /build/reproducible-path/octave-optics-0.1.4/inst/mueller_waveplate.m +[inst/stokes_isstokes.m] +>>>>> /build/reproducible-path/octave-optics-0.1.4/inst/stokes_isstokes.m ***** test - % test default return value - A = mueller_waveplate(); - R = A*A-A; - assert(norm(R,inf), 0, 1e-9); + % test type check + V1 = stokes_unpolarized(); + V2 = char(V1); + t1 = stokes_isstokes(V1); + t2 = stokes_isstokes(V2); + assert(t1 && ~t2); ***** test - % 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 size check + V1 = stokes_unpolarized(); + V2 = V1; + V2(5,1) = 1; + t1 = stokes_isstokes(V1); + t2 = stokes_isstokes(V2); + assert(t1 && ~t2); ***** 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; - assert(norm(R,inf), 0, 1e-9); + % 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 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 = mueller_waveplate(R); - csize = size(C); - assert(rsize == csize); - end -4 tests, 4 passed, 0 known failure, 0 skipped + % 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/zernike_noll_to_mn.m] >>>>> /build/reproducible-path/octave-optics-0.1.4/inst/zernike_noll_to_mn.m ***** test @@ -5030,44 +4847,42 @@ assert(m,[1 -2 1 -7]) assert(n,[1 2 3 7]) 10 tests, 10 passed, 0 known failure, 0 skipped -[inst/jones_linretarder.m] ->>>>> /build/reproducible-path/octave-optics-0.1.4/inst/jones_linretarder.m +[inst/jones_rotator.m] +>>>>> /build/reproducible-path/octave-optics-0.1.4/inst/jones_rotator.m ***** test % test default return value - A = jones_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 = jones_linretarder(phase); - A2 = jones_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 = jones_linretarder(phase1); - A2 = jones_linretarder(phase2); - A12 = jones_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 = 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 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); @@ -5075,16 +4890,45 @@ R = {R}; end rsize = size(R); - C = jones_linretarder(R); + C = jones_rotator(R); csize = size(C); assert(rsize == csize); end 5 tests, 5 passed, 0 known failure, 0 skipped -[inst/mueller_lindiattenuator.m] ->>>>> /build/reproducible-path/octave-optics-0.1.4/inst/mueller_lindiattenuator.m +[inst/jones_lpplus45.m] +>>>>> /build/reproducible-path/octave-optics-0.1.4/inst/jones_lpplus45.m ***** test % test default return value - A = mueller_lindiattenuator(); + V = jones_lpplus45(); + R = V-[1;1]; + assert(norm(R,inf), 0, 1e-9); + +***** test + % test return value + amplitude = rand(1, 1); + V = jones_lpplus45(amplitude); + R = V-[1;1]*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_lpplus45(R); + csize = size(C); + assert(rsize == csize); + end +3 tests, 3 passed, 0 known failure, 0 skipped +[inst/jones_lindiattenuator.m] +>>>>> /build/reproducible-path/octave-optics-0.1.4/inst/jones_lindiattenuator.m +***** test + % test default return value + A = jones_lindiattenuator(); R = A*A-A; assert(norm(R,inf), 0, 1e-9); @@ -5093,8 +4937,8 @@ d = rand(1, 1); kx = 1; ky = (1-d)./(1+d); - A1 = mueller_lindiattenuator(d); - A2 = mueller_lindiattenuator(kx, ky); + A1 = jones_lindiattenuator(d); + A2 = jones_lindiattenuator(kx, ky); R = A1-A2; assert(norm(R,inf), 0, 1e-9); @@ -5102,8 +4946,8 @@ % test serial application of linear diattenuators kx = rand(1, 1); ky = rand(1, 1); - A1 = mueller_lindiattenuator(kx,ky); - A2 = mueller_lindiattenuator(kx*kx,ky*ky); + A1 = jones_lindiattenuator(kx,ky); + A2 = jones_lindiattenuator(kx*kx,ky*ky); R = A1*A1-A2; assert(norm(R,inf), 0, 1e-9); @@ -5113,9 +4957,9 @@ kx2 = rand(1, 1); ky1 = rand(1, 1); ky2 = rand(1, 1); - A1 = mueller_lindiattenuator(kx1,ky1); - A2 = mueller_lindiattenuator(kx2,ky2); - A12 = mueller_lindiattenuator(kx1*kx2,ky1*ky2); + 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); @@ -5123,9 +4967,9 @@ % test mode kx = rand(1, 1); ky = rand(1, 1); - A1 = mueller_lindiattenuator(kx,ky); - A2 = mueller_lindiattenuator(kx,ky,'int'); - A3 = mueller_lindiattenuator(sqrt(kx),sqrt(ky),'amp'); + 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); @@ -5139,7 +4983,7 @@ R = {R}; end rsize = size(R); - C = mueller_lindiattenuator(R); + C = jones_lindiattenuator(R); csize = size(C); assert(rsize == csize); end @@ -5148,17 +4992,77 @@ % another test correct size of return values kx = rand(3,4,5); ky = rand(5,4,3); - C = mueller_lindiattenuator(kx,ky); + C = jones_lindiattenuator(kx,ky); csize = size(C); assert(csize == [5,4,5]); 7 tests, 7 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)) +[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_rotator.m] +>>>>> /build/reproducible-path/octave-optics-0.1.4/inst/mueller_rotator.m +***** test + % test default return value + 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 = mueller_rotator(angle); + A2 = mueller_rotator(angle*2); + R = A1*A1-A2; + assert(norm(R,inf), 0, 1e-9); + +***** test + % another test of serial application of rotator + 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; + assert(norm(R,inf), 0, 1e-9); + +***** test + % test different angle value interpretations + angle = rand(1, 1); + A1 = mueller_rotator(angle); + A2 = mueller_rotator(-angle*180/pi(), 'deg'); + R = A2*A1-mueller_unity(); + assert(norm(R,inf), 0, 1e-9); + +***** test + % test 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 = mueller_rotator(R); + csize = size(C); + assert(rsize == csize); + end 5 tests, 5 passed, 0 known failure, 0 skipped [inst/stokes_lpminus45.m] >>>>> /build/reproducible-path/octave-optics-0.1.4/inst/stokes_lpminus45.m @@ -5189,14 +5093,22 @@ 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 +[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/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_checkmueller(A1); - t2 = mueller_checkmueller(A2); + t1 = mueller_ismueller(A1); + t2 = mueller_ismueller(A2); assert(t1 && ~t2); ***** test @@ -5204,8 +5116,8 @@ A1 = mueller_unity(); A2 = A1; A2(5,5) = 1; - t1 = mueller_checkmueller(A1); - t2 = mueller_checkmueller(A2); + t1 = mueller_ismueller(A1); + t2 = mueller_ismueller(A2); assert(t1 && ~t2); ***** test @@ -5214,51 +5126,35 @@ A1{2,2,2} = 0; A2 = mueller_mirror([4,3,2]); A2{1,1,1} = 0; - t1 = mueller_checkmueller(A1); - t2 = mueller_checkmueller(A2); + 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} = ones(4,4)*0.99; + A1{2,2,2} = 0; A2 = mueller_mirror([4,3,2]); - A2{1,1,1} = ones(4,4)*1.01; - t1 = mueller_checkmueller(A1); - t2 = mueller_checkmueller(A2); + 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_linpolarizer.m] ->>>>> /build/reproducible-path/octave-optics-0.1.4/inst/jones_linpolarizer.m -***** test - % applying an ideal linear polarizer twice is identical to - % apply it once! - A = jones_linpolarizer(); - R = A*A-A; - assert(norm(R,inf), 0, 1e-9); - +[inst/zernike_polar.m] +>>>>> /build/reproducible-path/octave-optics-0.1.4/inst/zernike_polar.m ***** test - % test direct size parameter - for dim = 1:5 - asize = randi([1 4], 1, dim); - rsize = size(rand(asize)); - U = jones_linpolarizer(rsize); - usize = size(U); - assert(usize == rsize); - end - + 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 - % test indirect size parameter - for dim = 1:5 - asize = randi([1 4], 1, dim); - C = cell(asize); - csize = size(C); - U = jones_linpolarizer(C); - usize = size(U); - assert(usize == csize); - end - -3 tests, 3 passed, 0 known failure, 0 skipped + 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/zernike_osa_ansi_to_mn.m] >>>>> /build/reproducible-path/octave-optics-0.1.4/inst/zernike_osa_ansi_to_mn.m ***** test @@ -5339,105 +5235,106 @@ assert(m,[1 -1 -5 7]) assert(n,[1 3 5 7]) 2 tests, 2 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/stokes_intensity.m] ->>>>> /build/reproducible-path/octave-optics-0.1.4/inst/stokes_intensity.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)); - -***** 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/jones_rotate.m] ->>>>> /build/reproducible-path/octave-optics-0.1.4/inst/jones_rotate.m +[inst/mueller_lindiattenuator.m] +>>>>> /build/reproducible-path/octave-optics-0.1.4/inst/mueller_lindiattenuator.m ***** test - % default return value: unity matrix - A = jones_rotate(); + % test default return value + A = mueller_lindiattenuator(); 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; + % test equality of providing diattenuation or kx and ky + d = rand(1, 1); + kx = 1; + ky = (1-d)./(1+d); + A1 = mueller_lindiattenuator(d); + A2 = mueller_lindiattenuator(kx, ky); + R = A1-A2; 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; + % test serial application of linear diattenuators + kx = rand(1, 1); + ky = rand(1, 1); + A1 = mueller_lindiattenuator(kx,ky); + A2 = mueller_lindiattenuator(kx*kx,ky*ky); + R = A1*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); - JM = jones_linretarder(delay); - A1 = jones_rotate(JM, angle1); - A2 = jones_rotate(A1, angle2); - A12 = jones_rotate(JM, angle1+angle2); - R = A2-A12; + % 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 = mueller_lindiattenuator(kx1,ky1); + A2 = mueller_lindiattenuator(kx2,ky2); + A12 = mueller_lindiattenuator(kx1*kx2,ky1*ky2); + R = A1*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 mode + kx = rand(1, 1); + ky = rand(1, 1); + A1 = mueller_lindiattenuator(kx,ky); + A2 = mueller_lindiattenuator(kx,ky,'int'); + A3 = mueller_lindiattenuator(sqrt(kx),sqrt(ky),'amp'); + R1 = A1-A2; + R2 = A1-A3; + assert(norm(R1,inf)+norm(R2,inf), 0, 1e-9); ***** test - % size of return value determined by 1st argument - angle = rand(1,1); + % test correct size of return values for dim = 1:5 asize = randi([1 4], 1, dim); - rsize = size(rand(asize)); - C = jones_rotate(jones_unity(rsize), angle); + R = rand(asize); + if numel(R) == 1 + R = {R}; + end + rsize = size(R); + C = mueller_lindiattenuator(R); csize = size(C); assert(rsize == csize); end ***** test - % size if return value determined by 2nd argument + % another test correct size of return values + kx = rand(3,4,5); + ky = rand(5,4,3); + C = mueller_lindiattenuator(kx,ky); + csize = size(C); + assert(csize == [5,4,5]); +7 tests, 7 passed, 0 known failure, 0 skipped +[inst/mueller_waveplate.m] +>>>>> /build/reproducible-path/octave-optics-0.1.4/inst/mueller_waveplate.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; + 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; + 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); @@ -5445,48 +5342,74 @@ R = {R}; end rsize = size(R); - C = jones_rotate(jones_unity(), R); + C = mueller_waveplate(R); csize = size(C); assert(rsize == csize); end +4 tests, 4 passed, 0 known failure, 0 skipped +[inst/mueller_linretarder.m] +>>>>> /build/reproducible-path/octave-optics-0.1.4/inst/mueller_linretarder.m +***** test + % test default return value + A = mueller_linretarder(); + R = A*A-A; + assert(norm(R,inf), 0, 1e-9); ***** 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]); + % 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); -8 tests, 8 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) + % 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 - 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/jones_lpminus45.m] ->>>>> /build/reproducible-path/octave-optics-0.1.4/inst/jones_lpminus45.m + % 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); + R = rand(asize); + if numel(R) == 1 + R = {R}; + end + rsize = size(R); + C = mueller_linretarder(R); + csize = size(C); + assert(rsize == csize); + end +5 tests, 5 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_lpminus45(); - R = V-[1;-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_lpminus45(amplitude); - R = V-[1;-1]*amplitude; + V = jones_cpleft(amplitude); + R = V-[1;-1i]*amplitude; assert(norm(R,inf), 0, 1e-9); ***** test @@ -5498,7 +5421,7 @@ R = {R}; end rsize = size(R); - C = jones_lpminus45(R); + C = jones_cpleft(R); csize = size(C); assert(rsize == csize); end @@ -5532,13 +5455,12 @@ assert(rsize == csize); end 3 tests, 3 passed, 0 known failure, 0 skipped -[inst/mueller_linpolarizer.m] ->>>>> /build/reproducible-path/octave-optics-0.1.4/inst/mueller_linpolarizer.m +[inst/jones_mirror.m] +>>>>> /build/reproducible-path/octave-optics-0.1.4/inst/jones_mirror.m ***** test - % applying a linear polarizer twice is identical to - % apply it once! - A = mueller_linpolarizer(); - 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 @@ -5546,7 +5468,7 @@ for dim = 1:5 asize = randi([1 4], 1, dim); rsize = size(rand(asize)); - U = mueller_linpolarizer(rsize); + U = jones_mirror(rsize); usize = size(U); assert(usize == rsize); end @@ -5557,20 +5479,20 @@ asize = randi([1 4], 1, dim); C = cell(asize); csize = size(C); - U = mueller_linpolarizer(C); + U = jones_mirror(C); usize = size(U); assert(usize == 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 +[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_ismueller(A1); - t2 = mueller_ismueller(A2); + t1 = mueller_checkmueller(A1); + t2 = mueller_checkmueller(A2); assert(t1 && ~t2); ***** test @@ -5578,8 +5500,8 @@ A1 = mueller_unity(); A2 = A1; A2(5,5) = 1; - t1 = mueller_ismueller(A1); - t2 = mueller_ismueller(A2); + t1 = mueller_checkmueller(A1); + t2 = mueller_checkmueller(A2); assert(t1 && ~t2); ***** test @@ -5588,86 +5510,79 @@ A1{2,2,2} = 0; A2 = mueller_mirror([4,3,2]); A2{1,1,1} = 0; - t1 = mueller_ismueller(A1); - t2 = mueller_ismueller(A2); + t1 = mueller_checkmueller(A1); + t2 = mueller_checkmueller(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; + A1{2,2,2} = ones(4,4)*0.99; A2 = mueller_mirror([4,3,2]); - A2{1,1,1} = 0; - t1 = mueller_ismueller(A1); - t2 = mueller_ismueller(A2); + 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/stokes_lpplus45.m] ->>>>> /build/reproducible-path/octave-optics-0.1.4/inst/stokes_lpplus45.m +[inst/mueller_rotate.m] +>>>>> /build/reproducible-path/octave-optics-0.1.4/inst/mueller_rotate.m ***** test - % test default return value - V = stokes_lpplus45(); - R = V-[1;0;1;0]; + % default return value: unity matrix + A = mueller_rotate(); + R = A*A-A; 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; + % 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 - % 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/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))); + % 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; + 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/jones_lphorizontal.m] ->>>>> /build/reproducible-path/octave-optics-0.1.4/inst/jones_lphorizontal.m -***** test - % test default return value - V = jones_lphorizontal(); - R = V-[1;0]; + % 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; assert(norm(R,inf), 0, 1e-9); ***** test - % test return value - amplitude = rand(1, 1); - V = jones_lphorizontal(amplitude); - R = V-[1;0]*amplitude; + % 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; assert(norm(R,inf), 0, 1e-9); ***** test - % test correct 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); @@ -5675,98 +5590,61 @@ R = {R}; end rsize = size(R); - C = jones_lphorizontal(R); + C = mueller_rotate(mueller_unity(), R); csize = size(C); assert(rsize == csize); end -3 tests, 3 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])); + % 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]); -***** 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/mueller_stokes.m] ->>>>> /build/reproducible-path/octave-optics-0.1.4/inst/mueller_stokes.m -***** error A = mueller_stokes(); +8 tests, 8 passed, 0 known failure, 0 skipped +[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 = mueller_waveplate(rand(1,1),'wav'); - MM = mueller_stokes(M); + 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 mueller_stokes() with one cell array only! + % This test feeds jones() with one cell array only! angles = 0:360; - wps = mueller_rotate(mueller_waveplate(0.5, 'wav'), angles, 'deg'); - lightin = stokes_lphorizontal(); - lightout = mueller_stokes(mueller_linpolarizer(),wps,lightin); - ilightout = stokes_intensity(lightout); + 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 mueller_stokes() with two cell arrays. + % should not vary! + % This test feeds jones() with two cell arrays. angles = 0:360; - wps1 = mueller_rotate(mueller_waveplate(0.5, 'wav'), angles, 'deg'); - wps2 = mueller_rotate(mueller_waveplate(0.5, 'wav'), angles, 'deg'); - lightin = stokes_lphorizontal(); - lightout = mueller_stokes(mueller_linpolarizer(),wps2,wps1,lightin); - ilightout = stokes_intensity(lightout); + 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 = mueller_rotate(mueller_waveplate(0.5, 'wav'), angles, 'deg'); - lightin = stokes_lphorizontal(); - lightout = mueller_stokes(mueller_linpolarizer(),wps,lightin); - ilightout = stokes_intensity(lightout); + 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'); @@ -5779,13 +5657,13 @@ % final intensity should vary as cos(2*angle)^2. ***** demo angles = 0:360; - wps = mueller_rotate(mueller_waveplate(0.5, 'wav'), angles, 'deg'); - wps2 = mueller_rotate(mueller_waveplate(0.45, 'wav'), angles, 'deg'); - lightin = stokes_lphorizontal(); - lightout = mueller_stokes(mueller_linpolarizer(),wps,lightin); - ilightout = stokes_intensity(lightout); - lightout2 = mueller_stokes(mueller_linpolarizer(),wps2,lightin); - ilightout2 = stokes_intensity(lightout2); + 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'); @@ -5803,11 +5681,11 @@ % angles are in rows, delays in columns angle_all = repmat(angle, [length(delay), 1]); delay_all = repmat(delay', [1, length(angle)]); - wps3 = mueller_waveplate(delay_all, 'wav'); - wps3 = mueller_rotate(wps3, angle_all, 'deg'); - lightin = stokes_lphorizontal(); - lightout3 = mueller_stokes(mueller_linpolarizer(),wps3,lightin); - ilightout3 = stokes_intensity(lightout3); + 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'); @@ -5816,37 +5694,195 @@ 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 + % rotating waveplates with increasing delay and subsequent polarizer 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 +[inst/jones_lphorizontal.m] +>>>>> /build/reproducible-path/octave-optics-0.1.4/inst/jones_lphorizontal.m ***** test - % test mirror that is its own inverted element - A = mueller_mirror(); - R = (A-1\A); + % test default return value + V = jones_lphorizontal(); + R = V-[1;0]; assert(norm(R,inf), 0, 1e-9); ***** test - % test direct size parameter + % test return value + amplitude = rand(1, 1); + V = jones_lphorizontal(amplitude); + R = V-[1;0]*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); - rsize = size(rand(asize)); - U = mueller_mirror(rsize); - usize = size(U); - assert(usize == rsize); + R = rand(asize); + if numel(R) == 1 + R = {R}; + end + rsize = size(R); + C = jones_lphorizontal(R); + csize = size(C); + assert(rsize == csize); end +3 tests, 3 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/stokes_unpolarized.m] +>>>>> /build/reproducible-path/octave-optics-0.1.4/inst/stokes_unpolarized.m +***** test + % test default return value + V = stokes_unpolarized(); + R = V-[1;0;0;0]; + assert(norm(R,inf), 0, 1e-9); ***** test - % test indirect size parameter + % test return value + intensity = rand(1, 1); + V = stokes_unpolarized(intensity); + R = V-[1;0;0;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); - C = cell(asize); + R = rand(asize); + if numel(R) == 1 + R = {R}; + end + rsize = size(R); + C = stokes_unpolarized(R); csize = size(C); - U = mueller_mirror(C); - usize = size(U); - assert(usize == csize); + assert(rsize == csize); + end +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 +***** test + % test default return value + V = stokes_cpright(); + R = V-[1;0;0;1]; + 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; + 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_cpright(R); + csize = size(C); + assert(rsize == csize); + end +3 tests, 3 passed, 0 known failure, 0 skipped +[inst/jones_lpminus45.m] +>>>>> /build/reproducible-path/octave-optics-0.1.4/inst/jones_lpminus45.m +***** test + % test default return value + V = jones_lpminus45(); + R = V-[1;-1]; + assert(norm(R,inf), 0, 1e-9); + +***** test + % test return value + amplitude = rand(1, 1); + V = jones_lpminus45(amplitude); + R = V-[1;-1]*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_lpminus45(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 + % test default return value + A = mueller_homogeneous_elliptic_diattenuator(); + R = A*A-A; + assert(norm(R,inf), 0, 1e-9); + +***** test + % test modes + t0 = rand(1,1); + d = rand(1,1); + azimuth = rand(1,1); + ellipticity = rand(1,1); + A1 = mueller_homogeneous_elliptic_diattenuator(t0,d,azimuth,ellipticity); + A2 = mueller_homogeneous_elliptic_diattenuator(t0,d,azimuth*180/pi(),ellipticity,'deg'); + R = (A2-A1); + assert(norm(R,inf), 0, 1e-9); +***** test + % another test correct size of return values + t0 = rand(3,4,5); + d = rand(4,5,6); + azimuth = rand(5,4,3); + ellipticity = rand(6,5,4); + C = mueller_homogeneous_elliptic_diattenuator(t0,d,azimuth,ellipticity); + csize = size(C); + assert(csize == [6,5,6]); 3 tests, 3 passed, 0 known failure, 0 skipped Checking C++ files ... Done running the unit tests. @@ -5876,12 +5912,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/29575/tmp/hooks/B01_cleanup starting +I: user script /srv/workspace/pbuilder/29575/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/22190 and its subdirectories -I: Current time: Mon Nov 25 02:34:41 -12 2024 -I: pbuilder-time-stamp: 1732545281 +I: removing directory /srv/workspace/pbuilder/29575 and its subdirectories +I: Current time: Mon Dec 29 11:00:08 +14 2025 +I: pbuilder-time-stamp: 1766955608