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

Save results #75

Merged
merged 4 commits into from
Mar 5, 2021
Merged

Save results #75

merged 4 commits into from
Mar 5, 2021

Conversation

mdecleir
Copy link
Collaborator

When saving an extinction curve to a FITS file, it is now also saving the R(V) and A(V) values, and the uncertainties on the fitted parameters.

@codecov-io
Copy link

Codecov Report

Merging #75 (d703fae) into master (b18fafc) will decrease coverage by 0.13%.
The diff coverage is 18.18%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #75      +/-   ##
==========================================
- Coverage   46.13%   46.00%   -0.14%     
==========================================
  Files          18       18              
  Lines        2265     2276      +11     
==========================================
+ Hits         1045     1047       +2     
- Misses       1220     1229       +9     
Impacted Files Coverage Δ
measure_extinction/extdata.py 66.27% <18.18%> (-1.07%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b18fafc...d703fae. Read the comment docs.

@karllark karllark added the enhancement New feature or request label Feb 25, 2021
Copy link
Owner

@karllark karllark left a comment

Choose a reason for hiding this comment

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

Worried a little about duplication of capabilities.

Comment on lines 670 to 678
# save the column values if available
if "AV" in self.columns.keys():
hname.append("AV")
hcomment.append("V-band extinction A(V)")
hval.append(self.columns["AV"])
if "RV" in self.columns.keys():
hname.append("RV")
hcomment.append("total-to-selective extintion R(V)")
hval.append(self.columns["RV"])
Copy link
Owner

Choose a reason for hiding this comment

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

Isn't this done in the code right above? Maybe not, but it seems to be very similar. Maybe the column_info dictionary needs to be updated/populated/created if Av or Rv (or other column info) is in the self.columns dictionary?

Copy link
Collaborator Author

@mdecleir mdecleir Feb 25, 2021

Choose a reason for hiding this comment

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

I was confused about that myself. I saw the code just above with "column_info", but I was not sure what it is doing, and I didn't want to break anything, so just to be sure I added my own code, and knew you would complain if that was not the way to go :) I didn't fully understand what that part of the code is doing. It looks like it is saving what's in column_info, but column_info needs to be given as an argument with the save function. Is that how you are using the code? I.e. do you store the calculated AV and RV somewhere and then give it to the save function: extdata.save(column_info={blabla})? I directly store the calculated AV and RV in extdata.columns and then with this added code make sure extdata.columns is saved to the fits. If I have to give it as an argument to the save function, then the extdata.columns is kinda useless... Sorry if this is not very clear.

Copy link
Owner

Choose a reason for hiding this comment

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

I am wondering if a way forward would be to test if "AV"/"RV" are in the column_info dictionary. If they are, then do nothing and have the code use the column_info dict info to populate the fits header. If they are not present, then add the "AV"/"RV" info to the column_info dict (create it if needed) - this would use the existing column_info code to populate the fits header. This makes it clear what happens if both are specified and reduces duplicating capabilities in the code.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Ok, I can adjust the code in that way. I am not sure yet what to do with the uncertainties though. The EMCEE fit gives a minus and plus uncertainty, but the code is only accepting 1 uncertainty at this point. We can have a quick discussion on Wednesday about what conventions to use for uncertainties in general, and I will update the code after that.

Copy link
Owner

Choose a reason for hiding this comment

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

Great.

Yeah, I agree the way these values are handled isn't ideal. I'm thinking we should switch to saving them as a table in an extension instead of as header keywords (maybe keep a few as FITS header keywords as well?). Having the parameters in a table would allow for easy expansion and a much more compact form. I'll see about opening an issue for this.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I fixed the code so that it is clear what happens if both column_info and self.columns are populated. It will give preference to the information given in the column_info argument. This is a temporary work-around, and I agree that a table would be a better way to store all this information, as explained in issue #77.

@mdecleir mdecleir marked this pull request as ready for review March 4, 2021 20:54
Copy link
Owner

@karllark karllark left a comment

Choose a reason for hiding this comment

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

Look great.

@karllark karllark merged commit 5be6588 into karllark:master Mar 5, 2021
@mdecleir mdecleir deleted the save_results branch May 19, 2021 21:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants