Reorganise LALPulsar SFT library code
Description
LALPulsar library code for handling SFTs and related objects (timestamps, catalogs, PSDs, etc.) is currently split across 2 source files (shown with line numbers):
3615 SFTfileIO.c
3259 SFTutils.c
6874 total
with matching headers. Both of these source files have become quite large over the years, and functions for different objects/tasks have got mixed together, which makes both files quite hard to navigate. It's also no longer clear what is the organisational split between "I/O" and "utilities", e.g. SFTfileIO.c
contains plenty of code which is not directly related to SFT file I/O.
This MR reorganises this code as follows:
-
SFTutils.h
is deprecated, and its contents moved toSFTfileIO.h
. (LALPulsar will still installSFTutils.h
but if#include
d it will raise a#warning
and then just includeSFTfileIO.h
.) - The source code in both
SFTfileIO.c
andSFTutils.c
is reorganised into several new files:
92 SFTinternal.h # internal definitions and prototypes shared across all SFT code
537 FindFiles.c # XLALFindFiles()
1056 PSDtypes.c # functions for handling PSDs and noise weights
445 SFDBfileIO.c # XLALReadSFDB()
922 SFTcatalog.c # functions for handling SFT catalogs
1409 SFTfileIO.c # now just contains SFT file I/O code
364 SFTnaming.c # SFT file naming convention and related functions (e.g. looking up detector prefixes)
869 SFTtimestamps.c # functions for handling timestamps
1256 SFTtypes.c # basic functions for creating/destroying/manipulating SFT types, e.g. SFTtype, SFTVector, MultiSFTVector
6950 total
- Finally I've used
git blame -C
to try to update the copyright notices for all the new files.
The diffs for this MR probably won't be very helpful given the movement of code. Note that the overall lines of code hasn't changed much (6874 to 6950), which is hopefully a sign I haven't deleted anything important...
Aside from code reorganisation, there are a few other minor clean-ups:
- Removed the long-deprecated
PulsarSourceParams
struct fromPulsarDataTypes.h
; this struct was only used by thePulsarSignalParams
struct inGeneratePulsarSignal.h
, so I've just merged thePulsarSourceParams
struct definition into thePulsarSignalParams
struct. -
SFTfileIO.c
uses a functioncalc_crc64()
to compute the SFT check-sum; this function was originally copied from the SFT reference library, but since that code is now part of LALPulsar I've removed theSFTfileIO.c
version of the CRC function and instead pointedSFTfileIO.c
to the equivalent function inSFTReferenceLibrary.c
-
SFTReferenceLibrary.h
declares a functionReferenceSFTLibraryVersion()
; since this code is no longer a separate package, I've removed this function.
API Changes and Justification
Backwards Compatible Changes
-
This change does not modify any class/function/struct/type definitions in a public C header file or any Python class/function definitions -
This change adds new classes/functions/structs/types to a public C header file or Python module
Backwards Incompatible Changes
-
This change modifies an existing class/function/struct/type definition in a public C header file or Python module -
This change removes an existing class/function/struct/type from a public C header file or Python module
Removes deprecated functions/structs in the name of general housekeeping of the LALPulsar API; unlikely to break any downstream packages.