Skip to content

Conversation

@ssiccha
Copy link
Collaborator

@ssiccha ssiccha commented Jan 10, 2022

  • Improve documentation of IsReady
  • Improve RecogniseGeneric
    • Clean up of comments.
    • Some refactoring.
    • Improve the warning message if recognition of a node does not
      terminate. Since IsReady is not set, an error will be thrown once one
      wants do something with the recognition data structure. Thus it is not
      necessary to throw an error in RecogniseGeneric. Make
      sure that, if everything went fine, then IsReady is set directly
      before returning.
  • Rename and document recognition node constructor
    • Also rename the corresponding type.
      Rename as follows:
      RecognitionInfoType -> RecogNodeType
      EmptyRecognitionInfoRecord -> RecogNode

@codecov
Copy link

codecov bot commented Jan 10, 2022

Codecov Report

Merging #308 (cf86f68) into master (328466e) will decrease coverage by 0.01%.
The diff coverage is 75.67%.

@@            Coverage Diff             @@
##           master     #308      +/-   ##
==========================================
- Coverage   78.61%   78.60%   -0.02%     
==========================================
  Files          43       43              
  Lines       18433    18454      +21     
==========================================
+ Hits        14492    14506      +14     
- Misses       3941     3948       +7     
Impacted Files Coverage Δ
gap/projective/almostsimple.gi 66.04% <0.00%> (ø)
gap/base/recognition.gi 68.92% <76.47%> (-0.11%) ⬇️
gap/base/recognition.gd 100.00% <100.00%> (ø)
gap/generic/kernel.gi 89.51% <0.00%> (-0.57%) ⬇️
gap/projective/c3c5.gi 87.89% <0.00%> (+0.02%) ⬆️

@ssiccha
Copy link
Collaborator Author

ssiccha commented Jan 10, 2022

The lines which are not covered are mostly lines where recognition failed and I improved warning messages. I wouln't add extra tests for that since I'm a bit short on time. IMO we can ignore this.

@ssiccha
Copy link
Collaborator Author

ssiccha commented Jan 10, 2022

@FriedrichRober Since you also looked at the last PR concerning the docs of IsReady. Could you have a look at the updated documentation of IsReady again and tell me whether you think that's again an improvement?

@FriedrichRober
Copy link
Contributor

Yes, I will have a look today.

@ssiccha ssiccha force-pushed the ss/improve-RecogniseGeneric branch from d2f34bf to 19ef011 Compare January 10, 2022 14:32
Copy link
Contributor

@FriedrichRober FriedrichRober left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I only have some minor comments. The reworked documentation for IsReady is fine.

if not IsReady(rifac) then
# the recognition of the image failed, also give up here:
# IsReady is not set, thus abort the whole computation.
if InfoLevel(InfoRecog) = 1 and depth = 0 then Print("\n"); fi;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we print here some information that the computation is aborted?

Suggested change
if InfoLevel(InfoRecog) = 1 and depth = 0 then Print("\n"); fi;
if InfoLevel(InfoRecog) = 1 and depth = 0 then Print("\n"); fi;
Info(InfoRecog, 1,
"ImageRecogNode of node <ri> could not be recognised,",
" IsReady(<ri>) is not set!");

Copy link
Collaborator Author

@ssiccha ssiccha Jan 11, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point. I'll add such an info message to the "unfinished case". And now that I think about it, we don't need to print anything in the "image" or "kernel" parts of RecogniseGeneric, since the warning message is printed in the "unfinished case" part already.

Nvm, I was thinking about the mandarins. I'll update both warning messages.

SetParentRecogNode(riker,ri);
Info(InfoRecog,2,"Back from kernel (depth=",depth,").");

if not IsReady(riker) then
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here the same, maybe we should print something here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't need to print something here, since we're only "exiting". The warning message was already printed in one of the "failed cases" that is in the "unfinished case" part or in the "recognise the image" part.

@ssiccha ssiccha force-pushed the ss/improve-RecogniseGeneric branch from 19ef011 to 96ca419 Compare January 11, 2022 13:42
- Clean up of comments.
- Some refactoring.
- Improve the warning message if recognition of a node does not
  terminate. Since IsReady is not set, an error will be thrown once one
  wants do something with the recognition data structure. Thus it is not
  necessary to throw an error in RecogniseGeneric.  Make sure that, if
  everything went fine, then IsReady is set directly before returning.
@ssiccha ssiccha force-pushed the ss/improve-RecogniseGeneric branch from 96ca419 to d6b1fcf Compare January 11, 2022 13:58
@ssiccha
Copy link
Collaborator Author

ssiccha commented Jan 11, 2022

@FriedrichRober I think I have again made the docs of IsReady a bit more precise. Could you have another quick look? ^^

@ssiccha
Copy link
Collaborator Author

ssiccha commented Jan 11, 2022

Ah no, wait a second. I was in Mandarin-land again.

@ssiccha
Copy link
Collaborator Author

ssiccha commented Jan 11, 2022

Ok, now the docs of IsReady should be good to go. The version before the Fix docs of IsReady should be correct once Mandarins are implemented. But we'll see that once the Mandarins are actually finished.

@FriedrichRober
Copy link
Contributor

The doc of IsReady sounds now a bit more technical, but I understand what is going on. I approve.

end );

InstallOtherMethod( RecogNode,
"for backwards compatibility",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What are you trying to be backwards compatible with, though? is there still code in the repo that calls it like that? If so, can't we just update that code?

Other than that: any external code won't be calling RecogNode, as it didn't exist before, right? It'll call EmptyRecognitionInfoRecord, so that code needs to be adjusted anyway. Or perhaps we can retain EmptyRecognitionInfoRecord in a new file gap/obsolete.gi; but then that backwards compatible function can take of reordering the arguments.

Perhaps I am missing something, though?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps I am missing something, though?

Nope, that makes perfect sense, thanks! 👍

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm going with this:

Or perhaps we can retain EmptyRecognitionInfoRecord in a new file gap/obsolete.gi; but then that backwards compatible function can take of reordering the arguments.

Copy link
Member

@fingolfin fingolfin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me (but note my comment on the backwards compatibility method)

@ssiccha ssiccha force-pushed the ss/improve-RecogniseGeneric branch from dc93ddd to 5c08ab7 Compare January 26, 2022 06:33
@ssiccha
Copy link
Collaborator Author

ssiccha commented Jan 26, 2022

I had to fiddle around a bit with the backwards compatibility method, but now it works on my machine. I'll wait for tests to pass, then this gets merged.

Nope, there is an unbound global variable somewhere.

@ssiccha ssiccha force-pushed the ss/improve-RecogniseGeneric branch 2 times, most recently from 7f4b653 to c0d88de Compare January 26, 2022 07:09
Also rename the corresponding type.

Rename as follows:
RecognitionInfoType -> RecogNodeType
EmptyRecognitionInfoRecord -> RecogNode
@ssiccha ssiccha force-pushed the ss/improve-RecogniseGeneric branch from c0d88de to cf86f68 Compare January 26, 2022 07:22
@ssiccha ssiccha merged commit 4349d80 into gap-packages:master Jan 31, 2022
@ssiccha ssiccha deleted the ss/improve-RecogniseGeneric branch January 31, 2022 05:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants