Closed rpoleski closed 10 months ago
@rpoleski, from what I've tested here, there are two options:
__init__()
function of Coordinates
class, along with some input validation. In this case, the coordinate instance cannot be transformed to other frame because it raises a ValueError. It seems too strict to me, since some functions like galactic_l()
and a test would need to be removed.Coordinates
class is called (i.e. in three source files and two tests). It doesn't make the galactic frame illegal, but the transformations and tests remain valid.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.
@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.
Please add unit tests. This should be moved to a separate function because it gets quite long.
@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.
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?
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
@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.
Solved by @rapoliveira ! Closing
Coordinates
class subclassesSkyCoord
. Does anyone how to force it to be equatorial? In other words make'galactic'
frame illegal.