Compare commits
No commits in common. "03991a18ed16dc34e99b797fbb429c3f08bfe9ce" and "850c2e189fb566d04084126f800b6f268a5032fd" have entirely different histories.
03991a18ed
...
850c2e189f
11
signalgen.py
11
signalgen.py
|
@ -37,7 +37,7 @@ rng = np.random.default_rng()
|
||||||
def show_dynamic(
|
def show_dynamic(
|
||||||
dynamic_spectra: np.ndarray,
|
dynamic_spectra: np.ndarray,
|
||||||
title: Union[str, None] = None,
|
title: Union[str, None] = None,
|
||||||
save: Union[bool, None] = False
|
save: Union[bool, None] = False,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""
|
"""
|
||||||
Show a dynamic spectra by first flattening it
|
Show a dynamic spectra by first flattening it
|
||||||
|
@ -264,9 +264,6 @@ if __name__ == "__main__":
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"-o", "--output", dest="output", type=str, help="Set output directory."
|
"-o", "--output", dest="output", type=str, help="Set output directory."
|
||||||
)
|
)
|
||||||
parser.add_argument(
|
|
||||||
"-s", "--start", type=int, help="Zoomed plot start time bin."
|
|
||||||
)
|
|
||||||
parser.set_defaults(dm=250.0)
|
parser.set_defaults(dm=250.0)
|
||||||
parser.set_defaults(pWidth=0.001)
|
parser.set_defaults(pWidth=0.001)
|
||||||
parser.set_defaults(nsamp=int(3e5))
|
parser.set_defaults(nsamp=int(3e5))
|
||||||
|
@ -276,7 +273,6 @@ if __name__ == "__main__":
|
||||||
parser.set_defaults(plot=False)
|
parser.set_defaults(plot=False)
|
||||||
parser.set_defaults(rsamp=False)
|
parser.set_defaults(rsamp=False)
|
||||||
parser.set_defaults(output=None)
|
parser.set_defaults(output=None)
|
||||||
parser.set_defaults(start=-1)
|
|
||||||
values = parser.parse_args()
|
values = parser.parse_args()
|
||||||
|
|
||||||
#set working directory to ignored directory or set output
|
#set working directory to ignored directory or set output
|
||||||
|
@ -294,10 +290,7 @@ if __name__ == "__main__":
|
||||||
logging.info(f"Running with file {values.file}")
|
logging.info(f"Running with file {values.file}")
|
||||||
if values.plot:
|
if values.plot:
|
||||||
filterbankObj = Your(values.file)
|
filterbankObj = Your(values.file)
|
||||||
if values.start == -1:
|
spectra = filterbankObj.get_data(0, 524288)
|
||||||
spectra = filterbankObj.get_data(0, 524288)
|
|
||||||
else:
|
|
||||||
spectra = filterbankObj.get_data(values.start, 8900)
|
|
||||||
show_dynamic(spectra, f"{values.file} Dynamic Spectra", save=True)
|
show_dynamic(spectra, f"{values.file} Dynamic Spectra", save=True)
|
||||||
else:
|
else:
|
||||||
addBurst(values)
|
addBurst(values)
|
||||||
|
|
|
@ -11,9 +11,8 @@ import pandas as pd
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
logging.basicConfig(level=logging.INFO) #change for debug prints
|
logging.basicConfig(level=logging.INFO) #change for debug prints
|
||||||
|
|
||||||
INJECTION_FILE = os.path.join(".","out","2025-08-08T11-28-06.txt")
|
INJECTION_FILE = os.path.join(".","out","2025-07-31T17-25-54.txt")
|
||||||
DETECTION_FILE = os.path.join(".","out","plotOut.txt")
|
DETECTION_FILE = os.path.join(".","out","plotOut.txt")
|
||||||
EXCLUDE_FILES = True
|
|
||||||
|
|
||||||
def linesplit(line):
|
def linesplit(line):
|
||||||
"""
|
"""
|
||||||
|
@ -92,22 +91,20 @@ detections = detections.reset_index(drop=True)
|
||||||
summary(2)
|
summary(2)
|
||||||
|
|
||||||
#five files have SO MANY FALSE POSITIVES so get rid of them here?
|
#five files have SO MANY FALSE POSITIVES so get rid of them here?
|
||||||
if EXCLUDE_FILES:
|
remFiles = ["data_2025-04-30_07-53-07", "data_2025-05-01_07-47-34", "data_2025-04-24_07-36-04", "data_2025-04-29_07-50-16", "data_2025-04-30_08-18-17"]
|
||||||
remFiles = ["data_2025-04-30_07-53-07", "data_2025-05-01_07-47-34", "data_2025-04-24_07-36-04", "data_2025-04-29_07-50-16", "data_2025-04-30_08-18-17"]
|
logger.info("Filtering out the five problem files...")
|
||||||
logger.info("Filtering out the five problem files...")
|
remMask = [True] * len(detections['dm'])
|
||||||
remMask = [True] * len(detections['dm'])
|
for detection in detections.itertuples():
|
||||||
for detection in detections.itertuples():
|
if detection.file in remFiles:
|
||||||
if detection.file in remFiles:
|
remMask[detection.Index] = False
|
||||||
remMask[detection.Index] = False
|
detections = detections[remMask]
|
||||||
detections = detections[remMask]
|
detections = detections.reset_index(drop=True)
|
||||||
detections = detections.reset_index(drop=True)
|
summary(3)
|
||||||
summary(3)
|
|
||||||
|
|
||||||
postFilterCount = len(detections['dm'])
|
postFilterCount = len(detections['dm'])
|
||||||
|
logger.info(f"Removed {preFilterCount-postFilterCount} detections by filtering the following:")
|
||||||
logger.info(f"Removed {preFilterCount-postFilterCount} detections by filtering the following:")
|
for file in remFiles:
|
||||||
for file in remFiles:
|
logger.info(file+"_injected.fil")
|
||||||
logger.info(file+"_injected.fil")
|
|
||||||
|
|
||||||
#Let's do detection matching! Yaaaay!
|
#Let's do detection matching! Yaaaay!
|
||||||
#What detections line up to which injections? This will determine which ones got missed entirely.
|
#What detections line up to which injections? This will determine which ones got missed entirely.
|
||||||
|
|
Loading…
Reference in a new issue