Repository navigation
Reduce duplication of CompoundModel._initialize_slices - #16709
Conversation
…t with Model._initialize_slices
|
Thank you for your contribution to Astropy! 🌌 This checklist is meant to remind the package maintainers who will review this pull request of some common things to look for.
|
8a947fa to
38de69d
Compare
|
Marking this as 6.1.2 because it would simplify a bug fix in #16710, but we can change to 7.0.0 if anyone has any strong feelings. |
| if name not in param_metrics: | ||
| param_metrics[name] = {} |
There was a problem hiding this comment.
This looks equivalent to
| if name not in param_metrics: | |
| param_metrics[name] = {} | |
| param_metrics.setdefault(name, {}) |
but I also see that param_metrics is defined as a defaultdict(dict), so I don't understand why setting a default value is even needed.
https://github.com/astropy/astropy/blob/main/astropy/modeling/core.py#L2584
There was a problem hiding this comment.
I dug into this further and found a place where param_metrics was set (incorrectly) to a regular dictionary, so I've fixed this.
|
I'm happy to merge this but am not sure what towncrier is complaining about. |
|
I restarted and it passes |
|
v6.1.2 is out, which is probably why it won't let me merge. Is it OK to create a v6.1.3 milestone or should I assign 7.0.0? |
|
I assigned 7.0.0 for now but will create 6.1.3 later. Strangely I didn't have issues merging even before changing the milestone. |
|
I've changed it back to 6.1.2 to avoid confusion, will move it over to 6.1.3 when I do the post release steps. |
…709-on-v6.1.x Backport PR #16709 on branch v6.1.x (Reduce duplication of CompoundModel._initialize_slices)
Noticed that
CompoundModel._initialize_sliceswas duplicating most of the cost ofModel._initialize_slices, so I've combined the two and all the tests seem to pass!