-
Notifications
You must be signed in to change notification settings - Fork 17
USE CASES #181
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
Comments
These UCs are great. They need to always be in the form "Actor does Action on something". Only in the first one are we allowed an "Actor wants something", which scopes that UC. Please could you edit your UCs to keep the basic idea hyou had, but to put them into that format . You will find that following this rule has amazing properties of capturing critical details that really help when we come to the implementation step. |
I realize I broke my own rule a bit there too letting you want something in bullet ~4, so please can you fix that too..... Just change it to "Luis saves the output to file", so the "want" part is superfluous (or you wouldn't have saved it....). Note, there is an art to choosing the actor too. I generally recommend picking a real person but that person should "exemplify" the target audience. We would have to write quite different code if the user is a high-school student or a grad student or Mike Toney, for example. Since the success definition is that our target audience is happy, it is really helpful to have a person in mind and to think what would make them happy..... |
finally, do you agree that as a general matter that we want to return the morphed data on the same grid as the input morph data? I think this makes the most sense to me from the point of view of the user. I have a pattern and I just want it back again on the same grid but slightly modified. What we fit to what on what grid under the hood, the user probably doesn't care as long we make good choices for good accuracy. But finally we want to return it back on the original grid.....is my thought. Also, from a user perspective, I may want to give a target that is either lower or higher grid density than my morph data. I may also want to have the target narrower or broader than my morph data. I mean, why not, right? If i have a snippet of data in the middle of Q, I could still want to morph to it. So UCs for each of these would be good. We may find that in this latter case, accuracy is low, or that the range of the snippet domain needs to related to the flexibility of the morph. e.g., if we just doing a stretch or a shift the snippet can be short, but if we are doing a 5th order polynomial squeeze this range should be longer. It is not our job to police the users. Whatever software we give them they can use it well or badly, it is up to them, but we can do simple things to help them if they easy and quick to implement. I think the other morphs are limited to morph and target being on the same grid, so once we implement this for the squeeze I think we have some work to do to generalize them too. But the squeeze is a generalization of the others so once we figure this out, they will be quick. |
Hi Simon, thanks for the feedback, this makes more sense. I am and will be editing the UCs using the correct form. I agree with the UCs you just mentioned, UC3, UC5 and UC7 are examples of broader/narrower grid as well as different grids. We could create a couple of additional UCs specifically for different grid densities (e.g., morphing to a higher-density and a lower-density target), or we could add those conditions to an existing UC like UC3 for simplicity. Let me know what you'd prefer. I am starting fresh with a new branch and started creating new tests for each of these UCs. I am calling the morph function but the function is empty. So the idea is to have these tests set up and then commit them on a new PR (we can delete the previous one). I won't touch the function until we have all the correct tests, I think that was my mistake, too focused on the function makes me blind. Few questions: Do I need to create a test for the UCs that is the same but with API? I am not sure I understand how the test differs for API vs file. Also, I am writing all the tests in the same python file and I get some warning about duplicate code. Is this okey in the meantime? Very cool to see how I started with a very specific code for one case and now the code can be used for many more. |
By the way, for UC7, when the morph data axis is broader compared to the target data, do we also want to return the morphed data on the same axis as the unmorphed? |
Quick question: are we making the test/code harder than necessary by trying to unsqueeze the squeezed data, rather than just applying a squeeze directly to a dataset? Hardcoding the expected morph (by applying a known squeeze) in the test is straightforward, inverting the squeeze polynomial is harder due to the nonlinearity? |
ok, perfect. Simpler is better. However, conditionals don't really work in this for of UC, so it is often easier making a new UC, but it would be short, something like As "UC3.1-3.5 but target is on coarser grid than morph" |
Perfect. The way we can do the tests with The unit tests that we are working on here only test the API. We keep the other UCs for when we build the CLI or GUI. |
Great question. I think I like the logic that, as a user, I always get back the same thing. As programmers we always have the option of returning a warning or raising an exception if the user asks for something impossible. We can also think of specific UCs to help resolve hard questions. Here would be my UC. Let's say I want to use this to find some two-theta-zero offset (so just a shift morph). I could, in principle compute a target that is a single Bragg peak at the right position, then measure an entire diffraction pattern and apply a shift morph to line up just that Bragg peak. What I would want back is my morphed complete diffraction pattern, not the single Bragg peak. So I think the answer is yes. |
I am not sure I completely understand your question. These tests just capture the behavior, so we want a hard-coded starting and ending morph and target which is what we are doing. Then we assert that the expected and the actual are the same within whatever tolerance we choose. Any inversion will happen in the morphing code itself, which we just muck around with until the test passes. We will have to decide there whether to use a linear or quadratic or cubic spline and what fineness of grid to use and what regression engine to use etc. to make it work. That is kind of the point of the tests. They are actually way more important than the code, which is why we are spending so much time on them. Then we have all kinds of flexibility on the numerical side to make different choices. We can also change those things later and every time we make any changes anywhere in the code we will run all the tests and make sure they all still pass after we made that change...... |
Thanks for all the helpful feedback. I’ve implemented the suggested comments in the tests. I agree that, as users, we generally want the data to be returned on the same grid and within the same range. However, this can require extrapolation in certain UCs. Is that something we actually want to allow from a user perspective? And let them in their own risk? |
in real situations the extrapolations are tiny. I wouldn't worry about it and the inconvenience of having every dataset in set of 200 all on a different grid seems like something no-one wants to deal with. The extrapolations will also be highly controlled in most cases, for example a third order polynomial morphing diffraction data over a wide range, very little can go wrong. How about we store in the morph metadata any extrapolation points and allow the user to get this information. Then if they want to they can remove any extrapolation points themselves (and deal with the consequences of everything on a different grid). |
Your comment makes a lot of sense. I agree that for our diffraction real scenarios the extrapolation will be tinny. I was thinking in the case of a user that is trying to morph something in another field, and lets say he wants to squeeze with a 7th order polynomial, the extrapolation error will become significant. I think your idea of allowing the user to get the extrapolation points and remove them is excellent! And we can also add warnings for high order polynomials. |
Generate squeeze morph tests for different user cases.
UC1: Original UC
morph
objectsUC2: as UC1 but programmatic API
UC3: morph to synchrotron data
UC4: as UC3 but using the API
UC5: as UC3 but xfel data is in coarser grid than synchrotron data
UC6: as UC5 but using the API
UC7: as UC3 but xfel data is in finer grid than synchrotron data
UC8: as UC7 but using the API
UC9: as UC3 but Qmin xfel < Qmin synchrotron
UC10: as UC5 but using the API
UC11: morph to MD simulated data
UC12: as UC5 but using the API
The text was updated successfully, but these errors were encountered: