-
Notifications
You must be signed in to change notification settings - Fork 61
Average profile #309
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
base: master
Are you sure you want to change the base?
Average profile #309
Conversation
…idth in preferences
…Corrected coloring of profile lines.
…lyzed igram did not display the profile after analysis.
…for now. Also added the worker thread class but not using it yet. This can be used as a model for that task.
…view ronchi and foucalut generater
|
Oh. There are merge errors. This is related to my recent PR where I added the "origin" enum to a few functions. I can do the merge if you want Dale. I also marked this PR as draft. Search this web page for "draft" to see the link to switch it back. |
|
Go ahead. |
I had added a new parameter to that function. Fixed now. Also Dale added a file to one project file but forgot to add to the other 2.
|
I did the merge. It was much easier than I had expected. It builds in QT5, but there is a QT6-only build error. I don't have QT6 installed on my laptop and I don't understand the error, so if @atsju could look at this error and fix it? Or I can fix it Saturday. By the way, I love the new GUI for profile plot. I played with it for 15 minutes solid, lol. I don't like Dale's change to menu item "tools "stop auto invert". Dale you should do a "git checkout averageProfile" then "git pull" either now or after this PR is complete although at that point you can just pull master. |
|
Those were my temporary changes to keep the dialog from popping up until you had your permanent fix. |
|
The stop auto invert is leftover from much earlier time when there was no invert dialog. It may no longer be needed. |
|
I also forgot to mention the new profile line width items and fix to the color settings of the profile lines in the preferences. |
|
Profile offset reset will happen whenever you select different wave fronts. |
Co-authored-by: Julien Staub <atsju2@yahoo.fr>
I'm not sure if it's needed for most users but for me it's very helpful - well maybe only for testing. But I use it a lot. For testing. And it's kind of hidden in the menu system so I think it's fine. |
|
I have pulled the code and it compiles. I see the square contour plot but do not see the vertical blue bar for the right side. It will still drag that control however. I just realized an addition I want to add. That is overlay one ronchi with another to see how they are different. I bet AI can help me with that as well. |
That's not merged yet. It's in a PR that still needs approval. Also the compiler error is only for QT6. I don't understand what the cause is and hope that Julien fixes it but if not I'll look at it Saturday. Julien may be celebrating Christmas right now.
I prefer that you do those edits in any branch you want but if you do them in the averageProfile branch then they will get added to this PR and I prefer any changes related to a ronchi overlay feature to go into a seprate PR. So please don't push new changes to averageProfile until this PR is merged. But if you do we'll just enlarge the scope of this PR. |
|
Also tomorrow I'll be quite busy with visiting family so may not notice anything in my emails nor anything github related. 😄 |
|
I think I fixed the build. I'm more busy than expected so I don't know how much time I have available. Dale, you will need to pull the branch to avoid conflicts. As George explained: kindly avoid pushing new features to this branch until it's merged. It should probably already have been split into 2 or more PR but I don't want to refrain you developping so we will just take care of it as it is. Happy Xmas to you 2 :) |
Cpp-Linter Report
|
|
🚀 New build available for commit |
|
I would remove the ifdef notnowold. But then you would get my new feature as well. |
I'm not sure to understand. If you want to remove it and talk about "no new feature", go ahead and remove, your new feature is aleady in the code and compiled by default. Removing the old code is part of this PR. What we want to avoid is getting more unrelated features. Just remember to pull the branch now to avoid conflicts. As George and I pushed changes |
Noted! I only played with the profile stuff. I didn't look at the Ronchi stuff yet. I didn't look at the code changes yet either. I'll try removing that ifdef and rebuild. But not today. |
atsju
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did not test. Only code review.
| <layout class="QHBoxLayout" name="horizontalLayout_5"> | ||
| <item> | ||
| <widget class="QRadioButton" name="InvertWithoutAskingRb"> | ||
| <property name="text"> | ||
| <string>Don't Ask but Invert</string> | ||
| </property> | ||
| </widget> | ||
| </item> | ||
| <item> | ||
| <widget class="QRadioButton" name="AskDoNotInvertRb"> | ||
| <property name="text"> | ||
| <string>Ask but Don't Invert</string> | ||
| </property> | ||
| <property name="checked"> | ||
| <bool>true</bool> | ||
| </property> | ||
| </widget> | ||
| </item> | ||
| <item> | ||
| <widget class="QRadioButton" name="DoNotAskorInvertRb"> | ||
| <property name="text"> | ||
| <string>Don't ask or invert</string> | ||
| </property> | ||
| </widget> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this code and maybe more comes from when you modified the UI to show us a printscreen in discussion about the autoInvertDialog. But it seems unused. Should be removed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes that code is my temp fix. It should not be merged.
| // Note: outputLambda should be defined/accessible in your scope | ||
| settings.outputLambda = 550.0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
magic number ? Needs to be settable in UI ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as previous comment. Except filled in from the preference setting.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sorry I don't get this one. What one is "previous" ?
Does code need change so that 550 can be set in preference settings ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That value and all values in the new settings structure generated by AI are values that will not be used by current code. The real values come from foucaultview UI and the 550 is the output wavelength specified in the preferences under the configuration menu. 550 is the wavelength of green light in nanometers. I'm impressed that AI figured out a value for [t there even though it did not have access to the code where that value is set.
AI generated those default values which would be used only if we ever write code outside the foucaultview.cpp file to generate ronchi images where we don't have access to the foucaultview UI.
| } | ||
| qDebug() << "offsets" << m_waveFrontyOffsets<< y_offset; | ||
| // if show one angle | ||
| if (m_show_oneAngle or (!m_showAvg and !m_show_16_diameters & !m_show_oneAngle)){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| if (m_show_oneAngle or (!m_showAvg and !m_show_16_diameters & !m_show_oneAngle)){ | |
| if (m_show_oneAngle or (!m_showAvg and !m_show_16_diameters and !m_show_oneAngle)){ |
you are mixing logical operators and bitwise operator. Here you need && or and.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes the "and" is correct fix
| double lpi_val = s.lpi * (s.useMM ? 25.4 : 1.0); | ||
| int ppl = std::max(1, (int)((0.5 / lpi_val) / pixwidth)); | ||
| int start = (size / 2) - (ppl / 2); | ||
| bool even = ((start / ppl) % 2 == 0) ^ s.clearCenter; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| bool even = ((start / ppl) % 2 == 0) ^ s.clearCenter; | |
| bool even = ((start / ppl) % 2 == 0) != s.clearCenter; |
^ is a bitwise operator.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes I think in this case ^ is correct. This was code generated by AI a clever trick to test the int result being 0 or 1 along with the test for a clear center setting.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's working but it's bitwise operation. ^ is xor (mutual exclusive). But you shall use != For bool. It's same logic table but it's Boolean operation instead bitwise operation.
| { | ||
| } | ||
|
|
||
| void WavefrontLoaderWorker::process(QStringList args, SurfaceManager* manager) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| void WavefrontLoaderWorker::process(QStringList args, SurfaceManager* manager) { | |
| void WavefrontLoaderWorker::process(const QStringList& args, SurfaceManager* manager) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wavefrontloaderworker.cpp is not used and not really needed. It is a model for how to make a worker thread that I want to keep because it may someday help to restructure the code and make the UI more responsive. Go ahead and make the change if you want.
|
I think nearly all the changes to Foucaultview.cpp and .h are AI generated. I looked it over just a small amount and then just tested to see if it did what I wanted. For me it is not worth the trouble to modify any of it's decisions. I like what it produced. Julian my have other ideas and can run them by me but I don't really want to have to spend any time on it. |
Hi @githubdoe,
I'm really sorry if I'm sounding dense sometimes, English is not my first language. Can you kindly clarify if you want to merge this as is or if you want/allow me to do the changes in the branch ? I have no problem doing the changes so you can focus on the really important part. I might need some help, for example with #309 (comment) |
|
I can not make any changes to that code because my current code has added functionality in it that both you and George said not to push. |
Well there are 2 options. option 1, grab the changes we made so far and merge them in. I don't think we changed much so far. I merged in master - okay that's a big change but there were no merge conflicts reported by git and there was one small edit (one line of code changed) to get it to compile after the merge. Also Julien made a tiny change to get it to compile in QT6 (he added a single include). option 2, instead of pushing your current working copy to git (averageProfile branch) you can switch to a brand new branch and push that out so that it doesn't affect this PR. That way your working branch would be exactly as it is now. But eventually we want you to merge in master and the 2 changes I just mentioned in option 1. I'm not sure what Julien and Dale prefer. |
|
I wondered about those buttons and thought that it was a Qt5 thing. So did not play with them. There are just too tiny for me to read the text. Looks like the text does not even make through the black. So perhaps there are two problems.
|
|
I have asked AI about the problem and it says there must be a style sheet somewhere that is setting the global button style. To experiment add this code just before the compare dialog is opened. It works and now I can read the buttons. So I need to look for the overriding style sheet. Here is the code that makes the buttons readable: QString buttonStyle = "QPushButton { background-color: palette(button); color: palette(button-text); border: 1px solid gray; padding: 4px; }"; |
|
But I should not post too soon. Removing the lines in main.cpp did not fix it. Nor did turning off dark mode on my machine. |
|
Finally found the exact cause. The foucaultview.ui had a stylesheet that set background to black. Children of it inherit that. I no longer remember why it has that stylesheet. While trying to modify the background color in Qt Creator UI tool I deleted the stylesheet. There seems to be no undo. It is gone for now and does not seem to cause any problem on my machine. However others need to try once the code is updated. AI actually helped my isolate the issue to the foucaultview and then when given the .ui found the problem. |
|
The FoucaultView UI has nicer update and scan buttons now. I think I had put that old style onto them trying to make the better but I failed and forgot to remove the style. Sorry guys I'm planning on pushing all my current code to the averageprofile branh. I really want you guys to review it all anyway. So I will merge any current master parts I don't have then push. That is unless I get a push back no from you. |
Update from master that was changed since last update
|
I merged master into my branch and it all works. I can then push it to the remote if that is ok. |
… into averageProfile
|
No, this is great. I think the change to the .pro files got lost. I'll fix that. I think maybe I can do the "cherry pick" feature in git - I've never done that before. Regardless, I'll get this to compile. Should be easy. |
|
Oh it was indeed easy. Took 7 minutes (didn't feel that long!). Dale added ronchicomparedialog to only one of 3 project files. Hopefully it will compile with no errors and then I'll look it over. |
|
🚀 New build available for commit |
|
Sorry I keep forgetting to add new files to other .pro files. Thanks |
|
I played with the ability to diff two ronchi's. It shows the changes in red and green and is very cool - it trains your eyes where to look to see subtle changes to the mirror in the ronchigram. Nice feature. |
Yeah we need this to be "not set". Note that wavefront files (and much more) no longer prompt the users to change the wavefront. Co-authored-by: Julien Staub <atsju2@yahoo.fr>
Co-authored-by: Julien Staub <atsju2@yahoo.fr>
|
🚀 New build available for commit |
|
🚀 New build available for commit |
|
I see George has the vertical blue bar in the code now. I like it. |
|
Hi, sorry for delay, I haven't had much time available. Remains for you :
I will do review of added code later. |
|
Concerning the 550. There is now a new routine that users can call with this structure that makes ronchi images. The old code that made ronchi images has been refactored into using that new make ronchi image code. That new routine uses this structure with the 550 in it. The caller can use those default values if desired however the refactored code fills them in and in the case of the 550 it fills that in from the preferences data. Go look at the code that references that structure and you will see. Using Qt Creator it is easy to find all code that references something using a right click on the highlighted something. One way that structure could have been written is with no default values. Then there would be no 550. However AI elected to fill it with reasonable default values. If you think you need it put a comment out beside the 550 that describes it as the output wave length in nanometers. |




Added different way to create average profile and display it with right click menu.
Added other things to right click menu of profile plot.
Added right click menu of Ronchi image to create image of multiple ronchi images.
Added if you move the avg or single profile it will also move the 16 diameters profiles once they are displayed.
Profile offset will happen whenever you select different wave fronts.