rpoleski / MulensModel

Microlensing Modelling package
https://rpoleski.github.io/MulensModel/
Other
57 stars 15 forks source link

Force Astropy's SkyCoord to be equatorial #70

Closed rpoleski closed 10 months ago

rpoleski commented 1 year ago

Coordinates class subclasses SkyCoord. Does anyone how to force it to be equatorial? In other words make 'galactic' frame illegal.

rapoliveira commented 11 months ago

@rpoleski, from what I've tested here, there are two options:

rpoleski commented 11 months ago

As we talked offline - the problem is when the user calls Coordinates(SC) where SC is a SkyCoord object that is defined in galactic or ecliptic frame.

rapoliveira commented 10 months ago

@rpoleski I tried to fix in the last commit, but a input of Galactic object (instead of SkyCoord with frame='galactic') is still accepted. I will work more on it and write unit tests in the next days.

rpoleski commented 10 months ago

Please add unit tests. This should be moved to a separate function because it gets quite long.

rapoliveira commented 10 months ago

@rpoleski there is now a separate function to validate the Coordinates input. However, since transformations of coordinates also call this class, the transformation to galactic frame wasn't allowed and an old unit test was failing.

My last commit added an argument usr to correct it, but usr=True must now be added every time the class is called by the user to validate it. Do you have a better idea for that?

New unit tests were also added.

rpoleski commented 10 months ago

I've solved galactic_l/b issue and tried to push to your fork but couldn't:

git push raphael HEAD:raphael-hack-sessions  Enumerating objects: 18, done.
Counting objects: 100% (18/18), done.
Delta compression using up to 12 threads
Compressing objects: 100% (12/12), done.
Writing objects: 100% (12/12), 1.17 KiB | 1.17 MiB/s, done.
Total 12 (delta 8), reused 0 (delta 0), pack-reused 0
remote: Resolving deltas: 100% (8/8), completed with 5 local objects.
To github.com:rapoliveira/MulensModel.git
 ! [remote rejected]   HEAD -> raphael-hack-sessions (permission denied)
error: failed to push some refs to 'github.com:rapoliveira/MulensModel.git'

With other branch of yours it worked. Have you changed some settings?

rpoleski commented 10 months ago

In short - remove usr keyword and in coordinates.py:

-        gal_l = self.galactic.l
+        gal_l = SkyCoord(self).galactic.l
-        return self.galactic.b
+        return SkyCoord(self).galactic.b
rapoliveira commented 10 months ago

@rpoleski I just added you as collaborator of my forked repo and your two commits were there, in the right branch. I think you won't have this problem again.

rpoleski commented 10 months ago

Solved by @rapoliveira ! Closing