File:Incoherent sum of speckles.webm
Incoherent_sum_of_speckles.webm (WebM audio/video file, VP9, length 13 s, 480 × 534 pixels, 128 kbps overall, file size: 195 KB)
Captions
Summary
[edit]DescriptionIncoherent sum of speckles.webm |
English: Coherent light passing through a scattering medium is scrambled into a speckle pattern. But if there are multiple sources incoherent with each other, the resulting pattern will be the incoherent sum of the speckle patterns generated by each source. |
Date | |
Source | https://twitter.com/j_bertolotti/status/1553005005304696832 |
Author | Jacopo Bertolotti |
Permission (Reusing this file) |
https://twitter.com/j_bertolotti/status/1030470604418428929 |
Mathematica 13.0 code
[edit]dim = 256;
texture = ExampleData[{"Texture", "Sand3"}];
color1[x_] := RGBColor[0.368417, 0.506779, 0.709798, x];
color2[x_] := RGBColor[0.922526, 0.385626, 0.209179, x];
speckle[] :=
Abs[Fourier[
RandomComplex[{-1 - I, 1 + I}, {dim, dim}]*
GaussianMatrix[{dim/2, dim/30}][[1 ;; -2, 1 ;; -2]]]]^2;
tmp1 = speckle[]*
GaussianMatrix[{dim/2, dim/4}][[1 ;; -2, 1 ;; -2]]; tmp1 = tmp1/
Max[tmp1];
tmp2 = speckle[]*
GaussianMatrix[{dim/2, dim/4}][[1 ;; -2, 1 ;; -2]]; tmp2 = tmp2/
Max[tmp2];
tmp3 = speckle[]*
GaussianMatrix[{dim/2, dim/4}][[1 ;; -2, 1 ;; -2]]; tmp3 = tmp3/
Max[tmp3];
source1 =
RotateRight[
GaussianMatrix[{dim/2, dim/40}][[1 ;; -2, 1 ;; -2]], {-50,
20}]; source1 = source1/Max[source1];
source2 =
RotateRight[
GaussianMatrix[{dim/2, dim/40}][[1 ;; -2, 1 ;; -2]], {50,
80}]; source2 = source2/Max[source2];
source3 =
RotateRight[
GaussianMatrix[{dim/2, dim/40}][[1 ;; -2,
1 ;; -2]], {20, -50}]; source3 = source3/Max[source3];
frames1 = Table[
s = ArrayPlot[a*tmp1, DataReversed -> True,
ColorFunction -> "SunsetColors", ColorFunctionScaling -> False,
PlotRangePadding -> None];
sourceplot =
ArrayPlot[a*source1, DataReversed -> True,
ColorFunction -> "SunsetColors", ColorFunctionScaling -> False,
PlotRangePadding -> None];
Graphics3D[{
Texture[texture],
Polygon[{{-1.5, 2, -1.5}, {-1.5, 2, 1.5}, {1.5, 2, 1.5}, {1.5,
2, -1.5}},
VertexTextureCoordinates -> {{0, 0}, {1, 0}, {1, 1}, {0, 1}}],
Texture[sourceplot],
Polygon[{{-1.5, 5, -1.5}, {-1.5, 5, 1.5}, {1.5, 5, 1.5}, {1.5,
5, -1.5}},
VertexTextureCoordinates -> {{0, 0}, {1, 0}, {1, 1}, {0, 1}}]
, Black, Thick,
Line[{{-1.5, 2, -1.5}, {-1.5, 2, 1.5}, {1.5, 2, 1.5}, {1.5,
2, -1.5}, {-1.5, 2, -1.5}}],
Texture[s],
Polygon[{{-1.5, -1, -1.5}, {-1.5, -1, 1.5}, {1.5, -1,
1.5}, {1.5, -1, -1.5}},
VertexTextureCoordinates -> {{0, 0}, {1, 0}, {1, 1}, {0, 1}}]
}, PlotRange -> {{-2, 2}, {-1.5, 5}, {-2, 2}},
ViewPoint -> {-1.3, - 2.4, 2.}, Boxed -> False,
Lighting -> "Neutral", Background -> White]
, {a, 0, 1, 0.1}];
frames2 = Table[
s = ArrayPlot[a*tmp2, DataReversed -> True,
ColorFunction -> "SunsetColors", ColorFunctionScaling -> False,
PlotRangePadding -> None];
sourceplot =
ArrayPlot[a*source2, DataReversed -> True,
ColorFunction -> "SunsetColors", ColorFunctionScaling -> False,
PlotRangePadding -> None];
Graphics3D[{
Texture[texture],
Polygon[{{-1.5, 2, -1.5}, {-1.5, 2, 1.5}, {1.5, 2, 1.5}, {1.5,
2, -1.5}},
VertexTextureCoordinates -> {{0, 0}, {1, 0}, {1, 1}, {0, 1}}],
Texture[sourceplot],
Polygon[{{-1.5, 5, -1.5}, {-1.5, 5, 1.5}, {1.5, 5, 1.5}, {1.5,
5, -1.5}},
VertexTextureCoordinates -> {{0, 0}, {1, 0}, {1, 1}, {0, 1}}]
, Black, Thick,
Line[{{-1.5, 2, -1.5}, {-1.5, 2, 1.5}, {1.5, 2, 1.5}, {1.5,
2, -1.5}, {-1.5, 2, -1.5}}],
Texture[s],
Polygon[{{-1.5, -1, -1.5}, {-1.5, -1, 1.5}, {1.5, -1,
1.5}, {1.5, -1, -1.5}},
VertexTextureCoordinates -> {{0, 0}, {1, 0}, {1, 1}, {0, 1}}]
}, PlotRange -> {{-2, 2}, {-1.5, 5}, {-2, 2}},
ViewPoint -> {-1.3, - 2.4, 2.}, Boxed -> False,
Lighting -> "Neutral", Background -> White]
, {a, 0, 1, 0.1}];
frames3 = Table[
s = ArrayPlot[a*tmp3, DataReversed -> True,
ColorFunction -> "SunsetColors", ColorFunctionScaling -> False,
PlotRangePadding -> None];
sourceplot =
ArrayPlot[a*source3, DataReversed -> True,
ColorFunction -> "SunsetColors", ColorFunctionScaling -> False,
PlotRangePadding -> None];
Graphics3D[{
Texture[texture],
Polygon[{{-1.5, 2, -1.5}, {-1.5, 2, 1.5}, {1.5, 2, 1.5}, {1.5,
2, -1.5}},
VertexTextureCoordinates -> {{0, 0}, {1, 0}, {1, 1}, {0, 1}}],
Texture[sourceplot],
Polygon[{{-1.5, 5, -1.5}, {-1.5, 5, 1.5}, {1.5, 5, 1.5}, {1.5,
5, -1.5}},
VertexTextureCoordinates -> {{0, 0}, {1, 0}, {1, 1}, {0, 1}}]
, Black, Thick,
Line[{{-1.5, 2, -1.5}, {-1.5, 2, 1.5}, {1.5, 2, 1.5}, {1.5,
2, -1.5}, {-1.5, 2, -1.5}}],
Texture[s],
Polygon[{{-1.5, -1, -1.5}, {-1.5, -1, 1.5}, {1.5, -1,
1.5}, {1.5, -1, -1.5}},
VertexTextureCoordinates -> {{0, 0}, {1, 0}, {1, 1}, {0, 1}}]
}, PlotRange -> {{-2, 2}, {-1.5, 5}, {-2, 2}},
ViewPoint -> {-1.3, - 2.4, 2.}, Boxed -> False,
Lighting -> "Neutral", Background -> White]
, {a, 0, 1, 0.1}];
frames4 = Table[
s = ArrayPlot[a*(tmp1 + tmp2 + tmp3), DataReversed -> True,
ColorFunction -> "SunsetColors", ColorFunctionScaling -> False,
PlotRangePadding -> None];
sourceplot =
ArrayPlot[a*(source1 + source2 + source3), DataReversed -> True,
ColorFunction -> "SunsetColors", ColorFunctionScaling -> False,
PlotRangePadding -> None];
Graphics3D[{
Texture[texture],
Polygon[{{-1.5, 2, -1.5}, {-1.5, 2, 1.5}, {1.5, 2, 1.5}, {1.5,
2, -1.5}},
VertexTextureCoordinates -> {{0, 0}, {1, 0}, {1, 1}, {0, 1}}],
Texture[sourceplot],
Polygon[{{-1.5, 5, -1.5}, {-1.5, 5, 1.5}, {1.5, 5, 1.5}, {1.5,
5, -1.5}},
VertexTextureCoordinates -> {{0, 0}, {1, 0}, {1, 1}, {0, 1}}]
, Black, Thick,
Line[{{-1.5, 2, -1.5}, {-1.5, 2, 1.5}, {1.5, 2, 1.5}, {1.5,
2, -1.5}, {-1.5, 2, -1.5}}],
Texture[s],
Polygon[{{-1.5, -1, -1.5}, {-1.5, -1, 1.5}, {1.5, -1,
1.5}, {1.5, -1, -1.5}},
VertexTextureCoordinates -> {{0, 0}, {1, 0}, {1, 1}, {0, 1}}]
}, PlotRange -> {{-2, 2}, {-1.5, 5}, {-2, 2}},
ViewPoint -> {-1.3, - 2.4, 2.}, Boxed -> False,
Lighting -> "Neutral", Background -> White]
, {a, 0, 1, 0.1}];
time1 = Sum[
UnitStep[t - \[Tau]] E^(-0.5 (t - \[Tau])), {\[Tau],
Evaluate[
Accumulate@RandomVariate[ExponentialDistribution[0.1], {20}]]}];
timeseries1 = Table[time1, {t, 1, 100, 1}];
time2 = Sum[
UnitStep[t - \[Tau]] E^(-0.5 (t - \[Tau])), {\[Tau],
Evaluate[
Accumulate@RandomVariate[ExponentialDistribution[0.1], {20}]]}];
timeseries2 = Table[time2, {t, 1, 100, 1}];
time3 = Sum[
UnitStep[t - \[Tau]] E^(-0.5 (t - \[Tau])), {\[Tau],
Evaluate[
Accumulate@RandomVariate[ExponentialDistribution[0.1], {20}]]}];
timeseries3 = Table[time3, {t, 1, 100, 1}];
frames5 = Table[
s = ArrayPlot[(timeseries1[[t]]*tmp1 + timeseries2[[t]]*tmp2 +
timeseries3[[t]]*tmp3), DataReversed -> True,
ColorFunction -> "SunsetColors", ColorFunctionScaling -> False,
PlotRangePadding -> None];
sourceplot =
ArrayPlot[(timeseries1[[t]]*source1 + timeseries2[[t]]*source2 +
timeseries3[[t]]*source3), DataReversed -> True,
ColorFunction -> "SunsetColors", ColorFunctionScaling -> False,
PlotRangePadding -> None];
Graphics3D[{
Texture[texture],
Polygon[{{-1.5, 2, -1.5}, {-1.5, 2, 1.5}, {1.5, 2, 1.5}, {1.5,
2, -1.5}},
VertexTextureCoordinates -> {{0, 0}, {1, 0}, {1, 1}, {0, 1}}],
Texture[sourceplot],
Polygon[{{-1.5, 5, -1.5}, {-1.5, 5, 1.5}, {1.5, 5, 1.5}, {1.5,
5, -1.5}},
VertexTextureCoordinates -> {{0, 0}, {1, 0}, {1, 1}, {0, 1}}]
, Black, Thick,
Line[{{-1.5, 2, -1.5}, {-1.5, 2, 1.5}, {1.5, 2, 1.5}, {1.5,
2, -1.5}, {-1.5, 2, -1.5}}],
Texture[s],
Polygon[{{-1.5, -1, -1.5}, {-1.5, -1, 1.5}, {1.5, -1,
1.5}, {1.5, -1, -1.5}},
VertexTextureCoordinates -> {{0, 0}, {1, 0}, {1, 1}, {0, 1}}]
}, PlotRange -> {{-2, 2}, {-1.5, 5}, {-2, 2}},
ViewPoint -> {-1.3, - 2.4, 2.}, Boxed -> False,
Lighting -> "Neutral", Background -> White]
, {t, 1, 100, 1}];
Export["path/filename.mp4",
Join[frames1, Reverse[frames1], frames2, Reverse[frames2], frames3,
Reverse[frames3], frames4, Reverse[frames4], frames5]
, "AnimationRepetitions" -> \[Infinity], "DisplayDurations" -> 0.1]
Licensing
[edit]This file is made available under the Creative Commons CC0 1.0 Universal Public Domain Dedication. | |
The person who associated a work with this deed has dedicated the work to the public domain by waiving all of their rights to the work worldwide under copyright law, including all related and neighboring rights, to the extent allowed by law. You can copy, modify, distribute and perform the work, even for commercial purposes, all without asking permission.
http://creativecommons.org/publicdomain/zero/1.0/deed.enCC0Creative Commons Zero, Public Domain Dedicationfalsefalse |
File history
Click on a date/time to view the file as it appeared at that time.
Date/Time | Thumbnail | Dimensions | User | Comment | |
---|---|---|---|---|---|
current | 09:24, 1 August 2022 | 13 s, 480 × 534 (195 KB) | Berto (talk | contribs) | Uploaded own work with UploadWizard |
You cannot overwrite this file.
File usage on Commons
There are no pages that use this file.
Transcode status
Update transcode statusMetadata
This file contains additional information such as Exif metadata which may have been added by the digital camera, scanner, or software program used to create or digitize it. If the file has been modified from its original state, some details such as the timestamp may not fully reflect those of the original file. The timestamp is only as accurate as the clock in the camera, and it may be completely wrong.
User comments | Created with the Wolfram Language : www.wolfram.com |
---|---|
Software used |