Repository navigation
rebuilt trim_grid.py. is now more flexible, faster, and memory-efficient - #873
Conversation
|
I reformatted with black, so we should pass the codestyle test now, but IDK what's going on with the cov_test. standby. |
|
Okay so with that new functionality where a different value of sigma_fac could be calculated and used, we're naturally not getting back the number of trimmed SEDs that the test is expecting. |
|
The main description starts with "...ent". What does this mean? |
|
Codestyle test is still failing. Please fix. You said you used black, but that should have fixed things. Did you push the updated code? |
|
Why are the changes to docs in a different PR? |
karllark
left a comment
There was a problem hiding this comment.
Single comment, not a full review yet.
|
After discussion between Karl and myself, we decided to retain the calculation of sigma_fac, as a straight cutting at sigma_fac=3 could easily cut out models that represent a very small subset of good data. Along those same lines, I've removed the 0.1st and 99.9th percentiles and returned to a straight minimum and maximum for calculation of sigma_fac -- the thinking there was that those 0.2% of data points were photometric errors that won't be able to be properly fit. However, in the case where no bad data is in the catalog, this would systematically bias your results. The desire here is to ensure that all of the data can be represented by models retained post-trimming, so that even the weirdest, rarest stars have a chance of being adequately fit. Hence going back to the minimum and maximum of the data range. I estimate this will somewhat noticeably increase the number of models that are retained post trimming, but this should ensure we get more high quality fits. Additionally, this new PR will include updates to the docs -- explaining the new definition of sigma_fac, and clarifying how the cut_flag for ASTs should be defined -- and the reformatting with black so the codestyle test should not fail. I also changed the documentation for running the coverage tests, as that has been wrong for a while. The proper function call should be tox -e test -- --remote-data --cov, not tox -e test -- --remote-data --coverage. We will need to update the regression test to the new number of models that survive, but it is showing that with the new calculation of sigma_fac, we are now trimming fewer models than before, which is the expected behavior. |
karllark
left a comment
There was a problem hiding this comment.
Looks great. Thanks for this PR.
A couple of small comments requesting answers and then this PR is ready for merging.
|
All the delete statements were included for memory concerns. Basically I was testing this on my mac (which is not short for RAM) and was constantly getting kernel death from trying to hold 150 million SEDs in memory and writing a bunch of new variables and such. The delete statements helped mitigate that by ensuring that old variables were removed before writing new ones. I'm not married to this behavior and am willing to remove it, but when the model grids are large (>50 GB), this should help reduce the necessary memory to run this step. |
|
Updated the comment so it no longer mentions the 0.1 and 99.9 percentile cut (as we don't use it). cov_test still has the same issue where it expects a lower number of retained models than it's actually getting, which isn't surprising. Now there's a new doc_test issue though. |
|
The doc_test issues are due to other issues - like websites being down. |
I spent two weeks thinking this entire code was broken and needed to be rethought. Turns out it wasn't. Worked pretty well, other than being slow and needing a lot of memory.
The only functionality I ended up adding was some code that calculates an optimal value of sigma_fac (the factor by which you multiply the errors on the noisemodel to determine the rigidity with which the models are trimmed). The user now sets a value of sigma_fac (default is still 3.0), and this is now the minimum sigma_fac that gets used. Ensures that the brightest/faintest stars in a file aren't accidentally unable to be fit because their models get trimmed. I also removed the n_detected parameter from the function call, as that was not used anywhere.
I did pretty extensive testing of this and, though yes it does increase the number of models that make it through the trimming, it is still pretty efficient while being robust to outliers.
And all the worries I had about completeness were unwarranted. How the BEAST generates noisemodels is sound, as far as I can tell).