diffpy / diffpy.srmise

Other
0 stars 7 forks source link

Make modelclsuter instance work #74

Closed stevenhua0320 closed 2 months ago

sbillinge commented 2 months ago

This is honestly not the best way to "make things work" here. It would be better to write tests for the things and make the tests pass. But I think I am ok with this as I now see that @Ainamacar was bootstrapping (i.e., manually coding) iterable behavior in a python 2 code, but this is built in in python 3, so I think the code could quite easily be refactored and made more simple to run natively in py3, so just "getting it going" by running the old "if name == "main" code snippets, and then running examples to do some real clustering without stressing too much about code refactoring might be a good approach.

We could also use this opportunity to play around with how it could be refactored in py3. Not sure. Thoughts?

stevenhua0320 commented 2 months ago

This is honestly not the best way to "make things work" here. It would be better to write tests for the things and make the tests pass. But I think I am ok with this as I now see that @Ainamacar was bootstrapping (i.e., manually coding) iterable behavior in a python 2 code, but this is built in in python 3, so I think the code could quite easily be refactored and made more simple to run natively in py3, so just "getting it going" by running the old "if name == "main" code snippets, and then running examples to do some real clustering without stressing too much about code refactoring might be a good approach.

We could also use this opportunity to play around with how it could be refactored in py3. Not sure. Thoughts?

In this step I'm actually doing the step of running the old name == "main" code snippets, but then the py2 to py3 issue pops up (numpy float64 object to int issue etc.) So I first fixed them in order to run the examples successfully. And this is this PR's purpose. But I think this is the right approach. I think our workflow should be

  1. Run name == "main" code snippets, see if there is any errors/problems in the code, make small fixes to let it run, then make PR for that.
  2. Following the name == "main" code snippets, make tests for the important functions. See if there are any function breaking.
  3. Find the affected function, decide whether it is a py2 issue, and decide whether to just fix it or make a refactor to py3.