MFDv5 fails to inject into frequency-segmented noiseSFTs
@karl-wette via PyFstat we've discovered (cc @rodrigo.tenorio ) a failure mode of MFDv5 with --noiseSFTs
: if giving it a *
wildcard pattern that covers a set of frequency-segmented narrowband SFT files, then it only uses the first such file to check bandwidth and throws an error about a signal going somewhere into the middle of the band, and that would fit into the whole set just fine, not fitting into that first subband.
To reproduce, with the attached signal injection config file test_noiseSFTs_recycle.cff:
mkdir TestData
# save .cff file in there
# make initial broad SFT file:
lalapps_Makefakedata_v5 --outSingleSFT=TRUE --outSFTdir="TestData" --outLabel="test_noiseSFTs_broad" --IFOs="H1" --sqrtSX="1" --SFTWindowType="tukey" --SFTWindowBeta=0.001 --startTime=700000000 --duration=7200 --fmin=28.5 --Band=3 --Tsft=1800
# this works:
lalapps_Makefakedata_v5 --outSingleSFT=TRUE --outSFTdir="TestData" --outLabel="test_noiseSFTs_recycle" --noiseSFTs="TestData/*.sft" --SFTWindowType="tukey" --SFTWindowBeta=0.001 --startTime=700000000 --duration=7200 --Tsft=1800 --injectionSources="TestData/test_noiseSFTs_recycle.cff"
# split the original SFT into 3 sub-bands:
lalapps_splitSFTs --frequency-bandwidth 1 --start-frequency 28.5 --end-frequency 31.5 --output-directory TestData -- TestData/H-4_H1_1800SFT_test_noiseSFTs_broad-700000000-7200.sft
# now this fails:
lalapps_Makefakedata_v5 --outSingleSFT=TRUE --outSFTdir="TestData" --outLabel="test_noiseSFTs_recycle" --noiseSFTs="TestData/*NB*.sft" --SFTWindowType="tukey" --SFTWindowBeta=0.001 --startTime=700000000 --duration=7200 --Tsft=1800 --injectionSources="TestData/test_noiseSFTs_recycle.cff"
XLAL Error - XLALCWMakeFakeData (CWMakeFakeData.c:324): Error: injection signal 0:'TestData/test_noiseSFTs_recycle.cff:TS0' needs frequency band [29.996821,30.003178]Hz, injecting into [28.500000,29.499444]Hz
XLAL Error - XLALCWMakeFakeData (CWMakeFakeData.c:324): Invalid argument
XLAL Error - XLALCWMakeFakeMultiData (CWMakeFakeData.c:143): Check failed: XLALCWMakeFakeData ( svp, tsp, injectionSources, dataParams, X, edat ) == XLAL_SUCCESS
XLAL Error - XLALCWMakeFakeMultiData (CWMakeFakeData.c:143): Internal function call failed: Invalid argument
XLAL Error - main (makefakedata_v5.c:203): Check failed: XLALCWMakeFakeMultiData ( &mSFTs, &mTseries, injectionSources, &DataParams, GV.edat ) == XLAL_SUCCESS
XLAL Error - main (makefakedata_v5.c:203): Internal function call failed: Invalid argument
The problem is that in this block the [fMin,Band] pair is taken simply from multiNoiseCatalogView->data[0].data[0]
, i.e. the first file for the first detector.
To work in this case, one would have to loop through the whole catalog and get the min/max coverage.
But if one does that, one should also add sanity checks that the catalog is actually self-consistent: it looks to me that there's probably a lot of odd failure modes lurking if the user passes a wildcard covering NB files with gaps, merged files with inconsistent timestamps, etc...
Before I try hacking this, do we have library functions that already take care of this or part of it?
Note that MFDv4 does not run into this problem because it never tries to be smart and get the full band of noiseSFTs; it just forced the user to always set [fMin,Band] manually.