Skip to content

Comments

WIP: Update example to use spec object and units#163

Open
samaloney wants to merge 36 commits intosunpy:mainfrom
samaloney:docs-spec-object
Open

WIP: Update example to use spec object and units#163
samaloney wants to merge 36 commits intosunpy:mainfrom
samaloney:docs-spec-object

Conversation

@samaloney
Copy link
Member

@samaloney samaloney commented Oct 3, 2024

PR Description

Update exiting fitting demo to use units and work with astropy modelling.

Fixes example and unit handling in models.py. Also ensures minimzer reads photon_edges, needs to be looked at however as they are averaged edges.
Adds correct astropy into pyproject.toml
Fixes dependencies
Fix Scipy optimising function to correctly use bin_edges and add name to nonthermal along with limits on parameters
Spectrum llows counts fluxes and photon bins
Fix pre-commit
Fixes pre-commit
Fixes nonthermal test
Update astropy tag
Fixes pyproject.toml
Copy link
Contributor

@settwi settwi left a comment

Choose a reason for hiding this comment

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

Main thing that i would like to see changed is removal of the comment blocks

This is also a big PR. could you add a bit to the conversation about what tests are in place that correspond to the changes? it's a bit hard to parse through everything having not worked on it

finally i think we should revisit the bin centers vs edges question. i think having the option to do both is confusing and could lead to strange errors for folks doing analysis down the road

Copy link
Contributor

Choose a reason for hiding this comment

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

do we want to keep this file? it seems like it's just wrapping a function call. might be more flexible to just not have it

Comment on lines +32 to +44
# print(x)
# print(input_widths)
# print(self.matrix)
# print(c)
# print(output_widths)

# print(self.input_axis.size)
# print(self.output_axis.size)
# print(x.size)
# print(input_widths.size)
# print(self.matrix.size)
# print(c.size)
# print(output_widths.size)
Copy link
Contributor

Choose a reason for hiding this comment

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

for merging code we should delete chunks that are commented out

Comment on lines 86 to +89
if bin_specification == "edges":
obj._bin_edges = bin_edges
elif bin_specification == "centers":
obj._bin_edges = None
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 we should drop support for bin centers. for X-ray data, we only ever work with bins. for data that is not X-ray, we will need an entirely different format anyway.

Copy link
Contributor

Choose a reason for hiding this comment

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

Agreed!

Comment on lines +81 to +82
_input_units={"x": u.dimensionless_unscaled},
_output_units={"y": u.dimensionless_unscaled},
Copy link
Contributor

Choose a reason for hiding this comment

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

user-facing variables should not have underscores in front of them if they are supposed to be used. are these going to be commonly used? should they be given defaults instead?

@settwi settwi requested a review from ayshih June 12, 2025 21:09
@jajmitchell
Copy link
Contributor

jajmitchell commented Jun 16, 2025

@settwi , thanks for the comments. I will take a proper look through and make some changes later in the week, there are some things that definitely need changing and I will add some more description of all the changes that I have made. I am giving the workshop tomorrow and so need this branch to remain the same until after tomorrow

@settwi
Copy link
Contributor

settwi commented Jan 26, 2026

@jajmitchell what is the status of this branch?

@jajmitchell
Copy link
Contributor

@settwi I think that its best that this PR is broken down into a few smaller PRs with more defined scope, particularly as much will need to be changed, due to the decisions made regarding the spectrum object and fitter etc

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