Skip to content

plot_intensity() and plot_colors() show different results #30

Answered by rafael-fuente
CakeUser321 asked this question in Q&A
Discussion options

You must be logged in to vote

It's not a bug. F.get_colors() returns the colors according to the human color perception, which is not linear with the intensity of the field.
The human perception contrast is more accurately represented as 0.42 power of intensity. There is an implemented argument square_root = True in F.plot_intensity() that takes the square root of the intensity and therefore increases the contrast and matches more accurately the human perception scale:

import diffractsim
diffractsim.set_backend("CPU") #Change the string to "CUDA" to use GPU acceleration

from diffractsim import MonochromaticField, nm, mm, cm, CircularAperture, Lens

F = MonochromaticField(
    wavelength = 543 * nm, extent_x=13. * mm, e…

Replies: 3 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by rafael-fuente
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants
Converted from issue

This discussion was converted from issue #28 on September 25, 2022 22:24.