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

All purpose reduced X^2 #120

Closed
Catarina-Alves opened this issue Apr 12, 2019 · 6 comments
Closed

All purpose reduced X^2 #120

Catarina-Alves opened this issue Apr 12, 2019 · 6 comments
Assignees
Labels
enhancement Improvement to existing functionality or implementation, including adding a new functions/methods.

Comments

@Catarina-Alves
Copy link
Collaborator

We use the reduced X^2 a lot. However, the current code for it (in sndata) is not flexible enough. To overcome that, I have copied it to other places with minor modifications (gps). Despite that, I would like to make more changes and use it in a different way.

I propose to change the reduced X^2 code to analysis (as it is an analysis tool) and make it more flexible. This means that the code should be able to:

  • calculate the reduced X^2 on the models saved on the dataset
  • calculate the reduced X^2 on data that we input and not on the models saved on the dataset
  • calculate the reduced X^2 on a single object, a subset of objects or the whole dataset
  • calculate the reduced X^2 per filter or overall
  • return the reduced X^2 as a DataFrame/Table and not as a dictionary. This is useful as we can then append the values to a metadata table or somewhere else easily

I also think the reduced_chi_squared method should be a property that is updated when we change the models (the place where the GPs values are stored, for example).

After creating this new compute_reduced_chi_square (or another name that I find more self explanatory), I would change the way reduced X^2 are called in: analysis, sndata, gps, snfeatures (not sure about this last one, I need to see if it is a functionality that makes sense here where I am re-doing it).

If you would like to have more functionalities (the code to be more flexible in some way), please write it here.

@Catarina-Alves Catarina-Alves added enhancement Improvement to existing functionality or implementation, including adding a new functions/methods. new functionality labels Apr 12, 2019
@Catarina-Alves Catarina-Alves self-assigned this Apr 12, 2019
@Catarina-Alves
Copy link
Collaborator Author

Hopefully, this will also solve #91.

@rbiswas4
Copy link
Member

I think you are proposing to

  • have a function in analysis, that gets called from different modules like snfeatures.py, sndata.py etc., because there should be only one piece of code that can get called wherever needed.
  • This would mean that in analysis.py you would never be able to import any of the objects from these modules. This is the case in the current dev and could be the case in future ... though I would possibly expect such a file to have a name different from analysis which in my mind would use snmachine objects all the time.
  • Can you perhaps sketch out the call signatures of the functions or classes you intend to write?

@Catarina-Alves
Copy link
Collaborator Author

Catarina-Alves commented Apr 16, 2019

I think you are proposing to

  • have a function in analysis, that gets called from different modules like snfeatures.py, sndata.py etc., because there should be only one piece of code that can get called wherever needed.

Yes, exactly.

  • This would mean that in analysis.py you would never be able to import any of the objects from these modules. This is the case in the current dev and could be the case in future ... though I would possibly expect such a file to have a name different from analysis which in my mind would use snmachine objects all the time.

What name would you give it then? I think it is useful to have a file with the reduced X^2 that is called by other files.
The analysis file would then import sndata as you suggested.

  • Can you perhaps sketch out the call signatures of the functions or classes you intend to write?

@rbiswas4, I don't know what call signatures of the functions mean. Can you clarify it, please?

@rbiswas4
Copy link
Member

Sorry I missed this one:

What I mean is what are the arguments to the functions, and what will be the outputs? (But I was asking mostly because I was worried about circular imports ... since you are doing this differently now, I don't see this being a problem. We can see how things go along.

@Catarina-Alves
Copy link
Collaborator Author

Yes, after your comment I revised what I was going to do. Because of that, I am not making circular imports, thank you.

@tallamjr tallamjr added this to the reduced-chi-squared milestone Apr 29, 2019
@Catarina-Alves
Copy link
Collaborator Author

This is not the "real" reduced X^2 so we are going to call it chisq_over_datapoints.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Improvement to existing functionality or implementation, including adding a new functions/methods.
Projects
None yet
Development

No branches or pull requests

3 participants