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
shears (and other compound parameters) in configs #220
Comments
To clarify what I meant by the fact that we're not using Shear mutability in python: For
|
It occurs to me with this discussion that putting the shear, magnification, rotation and shift into the GSObjects directly, rather than using the current scheme of I'm also concerned about the user having direct access to these variables: So I think we should probably restrict access to these values to be only via the With the old config stuff, we dealt with this by having a very specific order of operations:
We can either maintain that definition or have the applications be in the order that they are listed in the config file, but whatever we do we need to be very explicit about how it works, since it has a huge potential for confusion on the part of the user if things work differently than they expect. |
This is indeed a big concern, and something I think we should figure out before we press forward too much with converting the GSObject classes. I have another alternative. I haven't worked out all the details, but I think it's promising:
I think it's very natural for users to want to know e.g. "the ellipticity" or "the size" of a simulated object, regardless of where those values came from, and I think that's also how they'll naturally think of them in input-catalog form. And while there are a lot of different mathematical definitions in use for many of these parameters, tying them all back to a 2x2 transform matrix is the clearest possible way to define what our code does. Some issues I can think of:
|
The problem isn't so much in the "getting", but rather the "setting". The natural thing to do is to have both an intrinsic ellipticity of a galaxy, and an applied shear. It's fine to store them as the net action (which won't be a symmetric matrix!), but we don't want to force the user to only set a single shear. They will often want to set these separately. That's the reason we did both ellip and shear in our old config style. So I think if we want to have these values stored in the GSObject directly, we should keep both ellip and shear separate. Then Then when we need an SBProfile, we build it, shear it by ellip, rotate it, shear it by shear, and then finally shift it. (As appropriate for the values that aren't None of course.) We didn't include the dilation, but that probably belongs either before or after shear (it doesn't matter, since those two do commute), since the inherent size is already given by the initial constructor. Then if we want, we can provide getters that do some calculation to determine the final net shape or size if people request it. And the apply methods would normally be ok, since you would typically do this to an object that had Nones to start with. But we would need to provide the correct action when everything is not None and then you shear it. (Especially if shift is not None at that point.) So that's a bit hairy. But the normal use case is not. |
I'm was not a fan of having a strict order for these things before, at least at the GSObject level; it is natural for making simple lensing tests, but I don't like the idea of hard-coding that into something that is more generically useful. What about shears due to optical distortions, for instance? Or changes in WCS coordinate systems? It seems like it's just not flexible enough, and that's because we're enforcing a distinction where mathematically there is none. Perhaps we just shouldn't have any setters on the GSObjects, only "appliers"? And a way to control the order different operations are applied through the config? That's the most mathematically straightforward approach, and we could maintain the ability to return the individual operation parameters if we wanted by storing the chain itself. |
That is definitely my preference for how the GSObjects work. (i.e. how it works now.) I thought that didn't work with your new config style though. |
I hadn't really been planning to have them work that way, but it makes sense, and I think it's certainly possible. An I have no objection to defining things as a sequence of applied transforms, as long as we don't restrict that sequence. We'll have to think a little about what the config syntax should look like. I'd be more okay with having a lensing-specific order there, because we might have a totally different config schema for doing other kinds of simulations. But if we can come up with a nice way to represent a generic sequence of transforms in config, I'd like that even better. |
Yes, I agree that it would be good if we can specify order of operations in config. |
Could we perhaps take this conversation to #195? I think that's the real issue we're talking about (though it may make this one a moot point). |
Yes, I think it should really go over there; this issue is just a minor off-shoot of the larger config and GSObject issues. On Jul 20, 2012, at 1:15 PM, Jim Bosch wrote:
Rachel Mandelbaum |
The Shear class is a little problematic for future configs (#148) or the new approach we're taking with the GSObject classes (#195), because in both of those contexts we need a method on the GSObject to fire when a parameter is changed. That works fine for scalars:
And it works fine if we set an entire Shear object at once:
But it doesn't work if we set the shear through its own mutators:
The same trouble appears if we use Position, Bounds, or Ellipse objects as GSObject parameters, though I don't think we actually do that anywhere now.
There are a couple of options here, none of them totally satisfactory:
I have a slight preference for the "make Shear immutable" approach - it disallows some convenient syntax, but it doesn't allow anything potentially confusing or quietly dangerous. But I'd like to solicit other opinions on this.
The text was updated successfully, but these errors were encountered: