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

FITSByte_* normalization returns wrong values #20

Open
JuergenTerpe opened this issue Jun 26, 2024 · 0 comments
Open

FITSByte_* normalization returns wrong values #20

JuergenTerpe opened this issue Jun 26, 2024 · 0 comments

Comments

@JuergenTerpe
Copy link

The method should use bigEndian, perhaps also the property float!

This returns a very high value for a linear FITS image:
public func normalize(_ bzero: Float = 0, _ bscale: Float = 1, _ min: FITSByte_16 = .min, _ max: FITSByte_16 = .max) -> Float {
return (bzero + Float(self) * bscale) / Self.range
}

This would return the correct value:
public func normalize(_ bzero: Float = 0, _ bscale: Float = 1, _ min: FITSByte_16 = .min, _ max: FITSByte_16 = .max) -> Float {
return (bzero + Float(self.bigEndian) * bscale) / Self.range
}

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

No branches or pull requests

1 participant