You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Astro.py currently takes several seconds to add a datasum to large fits files. In my tests using a 1.1GB fits file, where most of the data is in the primary HDU, it took ~2.5s to perform the following:
While implementing this in Haskell, I used the c code in the FITS 4.0 spec, and adding a datasum to the same HDU was about 10x faster.
Code is included here. There are small differences from the code in the FITS 4.0 spec, namely returning the resulting sum instead of passing in a pointer.
unsigned intchecksum (
unsigned char*buf,
intlength)
{
unsigned intsum32=0;
unsigned inthi, lo, hicarry, locarry, i;
// Accumulate the sum of the high-order 16 bits and the */// low-order 16 bits of each 32-bit word, separately. */// The first byte in each pair is the most significant. */// This algorithm works on both big and little endian machines.hi= (sum32 >> 16);
lo=sum32&0xFFFF;
for (i=0; i<length; i+=4) {
hi+= ((buf[i] << 8) +buf[i+1]);
lo+= ((buf[i+2] << 8) +buf[i+3]);
}
// fold carry bits from each 16 bit sum into the other sumhicarry=hi >> 16;
locarry=lo >> 16;
while (hicarry||locarry) {
hi= (hi&0xFFFF) +locarry;
lo= (lo&0xFFFF) +hicarry;
hicarry=hi >> 16;
locarry=lo >> 16;
}
// Concatenate the high and low parts to form the full 32-bit checksumreturn (hi << 16) +lo;
}
Additional context
No response
The text was updated successfully, but these errors were encountered:
Welcome to Astropy 👋 and thank you for your first issue!
A project member will respond to you as soon as possible; in the meantime, please double-check the guidelines for submitting issues and make sure you've provided the requested details.
GitHub issues in the Astropy repository are used to track bug reports and feature requests; If your issue poses a question about how to use Astropy, please instead raise your question in the Astropy Discourse user forum and close this issue.
If you feel that this issue has not been responded to in a timely manner, please send a message directly to the development mailing list. If the issue is urgent or sensitive in nature (e.g., a security vulnerability) please send an e-mail directly to the private e-mail feedback@astropy.org.
What is the problem this feature will solve?
Astro.py currently takes several seconds to add a datasum to large fits files. In my tests using a 1.1GB fits file, where most of the data is in the primary HDU, it took ~2.5s to perform the following:
Describe the desired outcome
While implementing this in Haskell, I used the c code in the FITS 4.0 spec, and adding a datasum to the same HDU was about 10x faster.
Code is included here. There are small differences from the code in the FITS 4.0 spec, namely returning the resulting sum instead of passing in a pointer.
Additional context
No response
The text was updated successfully, but these errors were encountered: