Skip to content
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

DM-17427: objectMasks: update parser to handle Goulding mask format #280

Merged
merged 1 commit into from Mar 6, 2019

Conversation

PaulPrice
Copy link
Contributor

Andy Goulding has provided new masks based on Gaia DR2, and with a
better tuned size; but the format is subtly different:

  • The rotation angle of a 'box' is not specified (it’s supposed to be
    zero anyway).
  • The 'ID:' string is replaced with 'Gaia DR2'.
  • Floating point values use scientific notation in places.

We've decided that (apart from the lack of "ID:", which we want in
order to be explicit) it's best to update the parser rather than fix
the mask files: the differences from what we have been expecting are
reasonable, and fixing the parser now means we may not have to fix
it much for the next version.

Expanded the regex to support the new format, defaulting the
rotation angle of boxes to 0. Added comments to the regex so it's
easier to understand.

@PaulPrice PaulPrice requested a review from natelust March 1, 2019 18:55

if _type == "box":
width = convertToAngle(param1, param1Unit, "width", fileName, lineNo)
height = convertToAngle(param2, param2Unit, "height", fileName, lineNo)
angle = convertToAngle(param3, param3Unit, "angle", fileName, lineNo)
if param3 is not None:
angle = convertToAngle(param3, param3Unit, "angle", fileName, lineNo)
Copy link
Contributor

Choose a reason for hiding this comment

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

You are basically doing work to optionally read in an angle if supplied but below there can only be an angle of zero, and it is only output as a warning. Should that be stronger than a warning as it is not going to do as the user requests? Or should we just take rotation out all the way?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I went to change this to an error, but then noticed that it actually does end up throwing an error because of this. It's putting out warnings as it reads each line, and then if there were any problems it throws an error when it's done reading. I think failing late here is the right thing to do, as it allows the user to fix all the bad lines rather than one by one (nicely done, @RobertLuptonTheGood!).

Andy Goulding has provided new masks based on Gaia DR2, and with a
better tuned size; but the format is subtly different:
* The rotation angle of a 'box' is not specified (it’s supposed to be
  zero anyway).
* The 'ID:' string is replaced with 'Gaia DR2'.
* Floating point values use scientific notation in places.

We've decided that (apart from the lack of "ID:", which we want in
order to be explicit) it's best to update the parser rather than fix
the mask files: the differences from what we have been expecting are
reasonable, and fixing the parser now means we may not have to fix
it much for the next version.

Expanded the regex to support the new format, defaulting the
rotation angle of boxes to 0. Added comments to the regex so it's
easier to understand.
@PaulPrice PaulPrice merged commit 411cdf7 into master Mar 6, 2019
@timj timj deleted the tickets/DM-17427 branch February 18, 2021 15:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants