Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DM-33993: Correct stellar locus plots for extinction #25

Merged
merged 4 commits into from Apr 6, 2022

Conversation

yalsayyad
Copy link
Contributor

No description provided.

@yalsayyad yalsayyad changed the title DM-339933: Correct stellar locus plots for extinction DM-33993: Correct stellar locus plots for extinction Mar 16, 2022
@arunkannawadi
Copy link
Member

Have same comments as Eli posted on Slack but otherwise all looks good to me.

ebv = df[self.ebv].values
col1Band = self.magDiff.col1.split('_')[0]
col2Band = self.magDiff.col2.split('_')[0]
av1 = self.extinctionCoeffs[col1Band]
Copy link
Contributor

Choose a reason for hiding this comment

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

It might be better with a useful error message here in case someone tries to run it with a filter name not in the dictionary.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, either a more helpful error or (alternatively) log a warning as above and don't apply extinction corrections. (And below for col2Band).

@yalsayyad yalsayyad force-pushed the tickets/DM-33993 branch 5 times, most recently from 3ae4e58 to 2ac1196 Compare March 18, 2022 05:00
Copy link
Contributor

@erykoff erykoff left a comment

Choose a reason for hiding this comment

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

Some minor changes, and a follow-up ticket.

default=MagDiff, dtype=DataFrameAction)
ebv = Field(doc="E(B-V) Column", dtype=str, default="ebv")
extinctionCoeffs = DictField(
doc="Dictionary of extinction coefficients for conversion from E(B-V) to extinction, A_filter."
Copy link
Contributor

Choose a reason for hiding this comment

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

This should be A_band. not A_filter.

def __call__(self, df):
diff = self.magDiff(df)
if not self.extinctionCoeffs:
_LOG.warn("No extinction Coefficients. Not applying extinction correction")
Copy link
Contributor

Choose a reason for hiding this comment

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

This should be _LOG.warning, as warn is deprecated.

ebv = df[self.ebv].values
col1Band = self.magDiff.col1.split('_')[0]
col2Band = self.magDiff.col2.split('_')[0]
av1 = self.extinctionCoeffs[col1Band]
Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, either a more helpful error or (alternatively) log a warning as above and don't apply extinction corrections. (And below for col2Band).

return diff

ebv = df[self.ebv].values
col1Band = self.magDiff.col1.split('_')[0]
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we always guarantee that the band will be the first part of the split on '_' or does this need to be another configuration parameter?
(Also, I don't have an easy answer to this, but I was getting confused because I was reading col as color but here it means column and has been commented elsewhere we have some naming inconsistencies and technical debt, and is not going to be fixed on this PR.)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Too late to change the naming convention of the Object Table now!

But if you want the band to be optionally supplied per config parameters you got it.

class ExtinctionCorrectedMagDiff(DataFrameAction):
magDiff = ConfigurableActionField(doc="Action that returns a difference in magnitudes",
default=MagDiff, dtype=DataFrameAction)
ebv = Field(doc="E(B-V) Column", dtype=str, default="ebv")
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this should be colEbv or something like that, because it's a column not a value.

if self.magDiff.returnMillimags:
correction = correction*1000.0

return diff - correction*u.mag
Copy link
Contributor

Choose a reason for hiding this comment

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

Upon further review, this is incorrect here and elsewhere (everywhere?) in analysis_drp, I fear. The units should not be u.mag but u.mmag if we're using millimags. This should be a separate ticket (@sr525 ).

Copy link
Contributor Author

@yalsayyad yalsayyad Mar 18, 2022

Choose a reason for hiding this comment

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

No prob. I changed MagDiff and this Action. I went to give your ColorDiff the same treatment but found that it was just a numpy array, so I'll be leaving the 1000* there.

 color_diff = color_diff.to(u.mmag)
AttributeError: 'numpy.ndarray' object has no attribute 'to'

@yalsayyad yalsayyad force-pushed the tickets/DM-33993 branch 2 times, most recently from 0c01f31 to fb3ae4a Compare March 19, 2022 00:12
per Task naming conventions. Important to do on this ticket
which requires config overrides from the obs packages.
Config overrides are looked up in <_DefaultName>.py
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.

None yet

4 participants