this post was submitted on 19 Oct 2023
75 points (98.7% liked)

Ask Science

8758 readers
1 users here now

Ask a science question, get a science answer.


Community Rules


Rule 1: Be respectful and inclusive.Treat others with respect, and maintain a positive atmosphere.


Rule 2: No harassment, hate speech, bigotry, or trolling.Avoid any form of harassment, hate speech, bigotry, or offensive behavior.


Rule 3: Engage in constructive discussions.Contribute to meaningful and constructive discussions that enhance scientific understanding.


Rule 4: No AI-generated answers.Strictly prohibit the use of AI-generated answers. Providing answers generated by AI systems is not allowed and may result in a ban.


Rule 5: Follow guidelines and moderators' instructions.Adhere to community guidelines and comply with instructions given by moderators.


Rule 6: Use appropriate language and tone.Communicate using suitable language and maintain a professional and respectful tone.


Rule 7: Report violations.Report any violations of the community rules to the moderators for appropriate action.


Rule 8: Foster a continuous learning environment.Encourage a continuous learning environment where members can share knowledge and engage in scientific discussions.


Rule 9: Source required for answers.Provide credible sources for answers. Failure to include a source may result in the removal of the answer to ensure information reliability.


By adhering to these rules, we create a welcoming and informative environment where science-related questions receive accurate and credible answers. Thank you for your cooperation in making the Ask Science community a valuable resource for scientific knowledge.

We retain the discretion to modify the rules as we deem necessary.


founded 2 years ago
MODERATORS
 

I picked up a low pressure sodium lamp and am working on a Halloween demonstration. I’m hoping to make a display that appears one way under normal light, but looks totally different under the monochromatic 589nm sodium vapor light.

So basically, I’m looking to generate a color wheel where I pick a shade of gray and get a list of colors that would look that gray under sodium vapor light.

…I feel like there must be a Python library for thing or something…

all 21 comments
sorted by: hot top controversial new old
[–] [email protected] 17 points 1 year ago (1 children)

Hmmmmmmmmm.... From a high level perspective you need to know the reflectivity of your combined pigments at that wavelength. If it's the same, they will look the same.

I don't know of anything easy you can use, but would suggest trying to find reflectance curves for each pigment you have available and making combinations that subtract to the same value at 589nm, or since 589 should be basically yellow, make up some colors where Y is constant and you change the ratio of C to R and try them out?

[–] [email protected] 3 points 1 year ago* (last edited 1 year ago)

That's true! Using RGB alone will not be enough to calculate this! Two materials that might appear equally yellow under white sunlight may appear different shades of yellow under sodium light. Technology Connections did a great video about the difference: https://piped.video/watch?v=uYbdx4I7STg

edit: he starts talking about sodium light in particular at 11:14

[–] [email protected] 12 points 1 year ago (1 children)

Low pressure sodium lamps have a pretty sharp spectrum: https://en.wikipedia.org/wiki/Sodium-vapor_lamp

Looking at the color spectrum, have you just tried and colors in the green to blue to purple range? I don’t think you need a Python library for this, I think you need to experiment. There’s a lot of dependence on the reflectivity of the material you’re looking at in addition to the color you see under sunlight or even indoor light with broad spectrum.

Try blue and green and see if both look the same under the lamp.

[–] [email protected] 3 points 1 year ago (1 children)

I was hoping I could avoid experimenting. CMYK light responses should be well controlled/documented, no?

[–] [email protected] 5 points 1 year ago

Thinking about this more , you probably want this to develop a curve in your color space that represents something with constant CMYK values for your chosen light source.

https://python-colormath.readthedocs.io/en/latest/conversions.html

E.g. your sodium light is 100% yellow, 10ish % magenta. Any color that varies cyan from 0%-100% and black from 0%-100% should presumably not reflect any additional color information (since the source light doesn’t have any cyan and black is just giving brightness)

I also think this means that as long as you hold Y and M constant, you can vary cyan and black for your comparison colors that will look the same. If you try to vary cyan and yellow or magenta at the same time then your effect probably won’t work.

This is tricky because you have multiple curves in the color space that are valid when just considering a single wavelength. The reality is, your lamp emits a spectrum of light (sharp, but still has a width). There’s also the variability in perception. But I’m not sure what the “bandwidth” of our eyes is and what color resolution humans are capable of detecting.

[–] [email protected] 8 points 1 year ago

So I'm really not sure how this works anymore but if you figure out which frequencies alias you can use https://academo.org/demos/wavelength-to-colour-relationship/ to do a conversion.

[–] [email protected] 6 points 1 year ago* (last edited 1 year ago)

Different printers have CMYK primaries with different spectra, so there’s not going to be a generic solution. But in principle, CMY can only create a linear combination of three discrete frequency bands, not a continuous spectrum.

The same will be true of the appearance under monochromatic light: you can only make colors that blend the monochromatic appearance of the primaries. So if none of the three primaries has the desired effect, you can’t create the effect by mixing them.

[–] [email protected] 6 points 1 year ago (1 children)
[–] [email protected] 11 points 1 year ago (1 children)

Only realised when I went to reply. Using sync your video link doesn't show. Here it is for other sync users.

https://youtu.be/fv-wlo8yVhk?si=cj3aaD8Ufm0Hlt6M

[–] [email protected] 6 points 1 year ago* (last edited 1 year ago) (2 children)
May be useful:
![Video about colors](https://youtu.be/fv-wlo8yVhk?si=cj3aaD8Ufm0Hlt6M)

So that's why, Sync tries to load this as an image, but there's no image link..

But apparently the link still works and is invisible in Sync.

[–] [email protected] 2 points 1 year ago (2 children)

Out of curiosity are you using quote or code tags? The HTML formatting in your post doesn't display correctly from kbin.

[–] [email protected] 5 points 1 year ago (1 children)

The Fediverse really needs to support standard markdown globally

[–] [email protected] 2 points 1 year ago

Well I do get a code block so I'm not sure if that's Kbin-specific markdown but I also get a bunch of HTML inside it too. I can't view the raw comment like I could with RES, but I would suspect that the raw Markdown characters should be sent with the post, for the website to support in its style-specific way, or something. This seems more like someone's client or app inappropriately inserting display style information into the post? But I could be totally wrong, I'm not an expert

[–] [email protected] 3 points 1 year ago

I'm just using the fenced code block markdown syntax.

[–] OvermindDL1 1 points 1 year ago* (last edited 1 year ago)

Yeah I thought ![...](...) in markdown is supposed to map to the img tag in html?

In fact, I'm almost certain of it... sec...

Yes, I'm right!

https://spec.commonmark.org/0.30/#images

![blah](blorp.vwoop) maps to, by the very spec itself: < img src="blorp" alt="blah" title="vwoop" /> (sans space because post stripping though, why are tags in code blocks stripped by the server instead of escaped???)

So if it links a youtube video... that... doesn't make sense? It's the img tag, not the link tag. It looks like Sync is correct here, it's putting it in an img tag, which is doing precisely what is expected for it to do?

[–] [email protected] 2 points 1 year ago

Would it count as easy to make the colors in a photo editing tool (picking things of the same value and saturation but different hues) and then converting to the CMYK designation?

[–] [email protected] 2 points 1 year ago* (last edited 1 year ago)

Is there an equation for this? Like y = f(x) where y is your choice of gray and x is your color. Maybe you can empirically find “f” by fitting randomly created “x” with the resulting “y”.

If “f” can be approximated and maybe there’s something special about it so that you can find the inverse. Otherwise, you could always just generate a bunch of “x*” again, feed through “f”, and see whether the output “y*” matches your chosen gray.

[–] [email protected] 1 points 1 year ago* (last edited 1 year ago)

Here's the Wikipedia section one general colour space, with a pretty diagram of chromaticity, and the one on CMYK colour conversion. What you want is the preimage of a CMYK colour projected into the entire perceptual space.

CMYK actually sounds kind of complicated to do this with, so yeah look for a pre-made function to convert CMYK to CIE 1931 in whatever "normal" light you have. I can help you find the preimage from that once you do.

Edit: Oh wait, this was a Halloween thing. Maybe for next year?