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

Warn user if map data type is smaller than photo data type #72

Open
ossama-othman opened this issue Jan 26, 2018 · 1 comment
Open

Warn user if map data type is smaller than photo data type #72

ossama-othman opened this issue Jan 26, 2018 · 1 comment

Comments

@ossama-othman
Copy link
Owner

ossama-othman commented Jan 26, 2018

MaRC blindly accepts the map data type specified by the user without checking to see if it is large enough to hold photo image data without loss of precision (e.g. photo data is a 4 byte integer, but the map data type is a 2 byte integer). At the very least, MaRC should warn the user about the potential loss of precision.

See #62 for a related issue.

@ossama-othman
Copy link
Owner Author

A more sophisticated check would involve checking the photo image data to determine if it would fit into a map with a smaller data type. This can be achieved by either of the following, or a combination of them:

  • Retrieve the DATAMIN and DATAMAX values, if available, from the photo image FITS file. Convert them to image array values by reversing the physical data = image data * BSCALE + BZERO transformation (BSCALE = 1 and BZERO = 0, if not available). Alternatively, BSCALE and BZERO could be applied to the map data type minimum and maximum. The photo image data minimum and maximum values could then be compared to the map data type minimum and maximum to determine if they will fit. New scale and offset values could be calculated through the MaRC::scale_and_offset() function, if choosing new values is an option.
  • Search for the minimum and maximum values in the source image array, and repeat the above source image / map data type comparison, as well as potential calculation of scale and offset values.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant