Skip to content

add magMWdust function#19

Open
AngusWright wants to merge 21 commits into
asgr:masterfrom
AngusWright:master
Open

add magMWdust function#19
AngusWright wants to merge 21 commits into
asgr:masterfrom
AngusWright:master

Conversation

@AngusWright

Copy link
Copy Markdown

Adds functionality to add a MW dust distribution to magproj() maps, using a lookup table of values drawn from the SFD dust maps. The values can be plotted as points or polygons, and scaled to chosen white/black limits, opacities, magmap() scaling, etc.

Function is ~30 lines, documentation is ~70 lines, and lookup table is ~38k lines.

Copilot AI review requested due to automatic review settings June 4, 2026 07:20

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Adds a new plotting helper to overlay a Milky Way dust layer (from an SFD-derived lookup table) onto existing magproj sky plots, with both point and polygon rendering modes.

Changes:

  • Introduces magMWdust() R function to read/map dust values to opacity and plot via magproj.
  • Adds Rd documentation and examples for the new plotting helper.

Reviewed changes

Copilot reviewed 2 out of 3 changed files in this pull request and generated 7 comments.

File Description
R/magMWdust.R Implements magMWdust() to map dust values to opacity and render as points or polygons.
man/magMWdust.Rd Documents the new function, its parameters, behavior, and usage examples.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread R/magMWdust.R Outdated
Comment thread R/magMWdust.R Outdated
Comment thread man/magMWdust.Rd Outdated
Comment thread R/magMWdust.R Outdated
Comment thread R/magMWdust.R Outdated
Comment thread R/magMWdust.R Outdated
Comment thread man/magMWdust.Rd Outdated
@asgr

asgr commented Jun 4, 2026

Copy link
Copy Markdown
Owner

Can you see the auto copilot comments @AngusWright ? The main (fairly minor) change is to use the package data(dust_data) method for loading data. The best practice way to do this is to have an argument (something like dust_data) where the default is NULL, and in that case inside the function it loads the included dust with data(dust_date), but otherwise it lets you pass in your own user defined dust input (in the correct format of course). This is how ProSpectSED works with loading default libraries (check the top of that function if you want to see an Example).

@AngusWright

Copy link
Copy Markdown
Author

yes updating the code now

@asgr asgr left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Just some questions and a suggested reference to be added.

Comment thread R/magMWdust.R Outdated
# If none provided, read the dust map data, which is a dlon=dlat=1 sampling
if (is.null(dust.data)) {
# Define the dlon and dlat values
dlon <- dlat <- 0.99

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

What's the reason you set this to 0.99 here?

Comment thread man/magMWdust.Rd
}
\item{dlon}{
Step size between element of longitude. Required when specifying dust.data directly,
and uses \code{dlon=1} when lazy-loading the internal dust map.

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

But don't you set it to 0.99...?

Comment thread man/magMWdust.Rd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants