Skip to content
This repository has been archived by the owner on Oct 23, 2022. It is now read-only.

Add glass map #164

Merged
merged 21 commits into from
May 6, 2021
Merged

Add glass map #164

merged 21 commits into from
May 6, 2021

Conversation

BrianGun
Copy link
Contributor

@BrianGun BrianGun commented Apr 30, 2021

Pull Request Template

Description

Added a function to draw glass maps of glass catalogs

Fixes #163

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

Visual verification of plot

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules
  • I have checked my code and corrected any misspellings

Fixes #163

got basic scatter plot done but there are weird values in the NIKON glass catalog that are messing things up.
…glasses that have nearly identical [index,dispersion] points so the names don't overlap. Still need to figure out how to get markers not to draw in scatter plot. Setting markershape = :none doesn't work.
@codecov-commenter

This comment has been minimized.

@friggog friggog changed the title BrianGun/issue163 Add glass map Apr 30, 2021
@friggog
Copy link
Collaborator

friggog commented Apr 30, 2021

Maybe marker=:none or marker=nothing? I remember plots args being a real pain and often just not working at all...

src/GlassCat/utilities.jl Outdated Show resolved Hide resolved
src/GlassCat/utilities.jl Outdated Show resolved Hide resolved
BrianGun and others added 3 commits April 30, 2021 15:31
Fixes #163

got basic scatter plot done but there are weird values in the NIKON glass catalog that are messing things up.
Could be improved to show popup menu of glasses that have nearly identical
[index,dispersion] points so the names don't overlap. Still need to figure out
how to get markers not to draw in scatter plot. Setting markershape = :none
doesn't work.
* whitespace

* export glasscatmap

* format docstring

* typed function signature

* u"nm" -> nm

* chained comparisons and simplified boolean expression
@BrianGun
Copy link
Contributor Author

BrianGun commented Apr 30, 2021

I tried marker = :none and that didn't do anything. The markers still showed up so instead I scaled them to size 0. Which only made them small, not invisible.

Maybe marker=:none or marker=nothing? I remember plots args being a real pain and often just not working at all...

@BrianGun
Copy link
Contributor Author

BrianGun commented May 1, 2021

@friggog or @alfredclwong could you review and approve if there are no remaining issues?

Are there any remaining questions? In the future we can change the behavior with respect to glasses that have _ in the name. Are there any blocking issues?

set the alpha of the markers to zero so now they don't draw. It's a hack but seems to work.

BrianGun and others added 2 commits April 30, 2021 17:17
Fixes #163

set markeraplha = 0 so the marker shapes don't show up in the glassmap plot.
g = x -> ForwardDiff.derivative(f, x);
dispersion = g(wavelength)

if (mindispersion <= dispersion <= maxdispersion) && (showprefixglasses ? true : !hasprefix) #don't show glasses that have an _ in the name. This prevents cluttering the map with many glasses of similar (index,dispersion).
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have a strong preference for the regular boolean expression (showprefixglasses || !hasprefix) as opposed to the ternary expression (showprefixglasses ? true : !hasprefix). Was there a reason for adding this back in?

end
end
series_annotations = Plots.series_annotations(glassnames, Plots.font(family = "Sans", pointsize = glassfontsize, color = RGB(0.0,0.0,.4)))
scatter(dispersions,indices, xaxis = "dispersion", yaxis = "index", series_annotations = series_annotations, markersize = .001, legends = :none, markeralpha = 0.0, markershape = :none, title = "Glass Catalog: $glasscatalog")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are markersize and markershape still needed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no

@alfredclwong
Copy link
Collaborator

@friggog or @alfredclwong could you review and approve if there are no remaining issues?

Are there any remaining questions? In the future we can change the behavior with respect to glasses that have _ in the name. Are there any blocking issues?

set the alpha of the markers to zero so now they don't draw. It's a hack but seems to work.

@BrianGun I posted a few questions above. I think it's safe to remove markersize and markershape, but it might be worth running the code again to see if it still works the way you want it to.

BrianGun and others added 2 commits May 5, 2021 09:37
Fixes #163

added comment explaining markeraplha = 0 argument to scatter.
@BrianGun
Copy link
Contributor Author

BrianGun commented May 5, 2021

@alfredclwong everything looks fine. However I cannot verify that the examples are rendering correctly since there is some obscure problem on my local machine that prevents any of the example images from being rendered. Could you verify the glassmap example shows up properly in the Examples docs and then approve?

@alfredclwong
Copy link
Collaborator

@alfredclwong everything looks fine. However I cannot verify that the examples are rendering correctly since there is some obscure problem on my local machine that prevents any of the example images from being rendered. Could you verify the glassmap example shows up properly in the Examples docs and then approve?

I don't see any changes to the Examples docs on this branch. Are the changes pushed? If you're having problems with the docs locally, you should still be able to see them here https://microsoft.github.io/OpticSim.jl/previews/PR164/examples/.

@BrianGun
Copy link
Contributor Author

BrianGun commented May 6, 2021

@alfredclwong The changes aren't in the Examples docs. They are in the GlassCat function docs. The new function shows up there in the preview docs. Everything seems to be working. Could you approve?

@alfredclwong
Copy link
Collaborator

@alfredclwong The changes aren't in the Examples docs. They are in the GlassCat function docs. The new function shows up there in the preview docs. Everything seems to be working. Could you approve?

Ah I thought you meant that you'd put in an example of the plot somewhere. Looks good.

@BrianGun BrianGun merged commit 69b8b74 into main May 6, 2021
@BrianGun BrianGun deleted the BrianGun/issue163 branch May 6, 2021 22:44
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Draw glass map
4 participants