Skip to content

Commit

Permalink
pe.py: make globbing of pulsar file directory recursive to be consist…
Browse files Browse the repository at this point in the history
…ent with heterodyning
  • Loading branch information
mattpitkin committed Mar 18, 2024
1 parent 4bf53e2 commit 1d1d21f
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions cwinpy/pe/pe.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import sys
import warnings
from argparse import ArgumentParser
from pathlib import Path

import bilby
import numpy as np
Expand Down Expand Up @@ -1545,16 +1546,14 @@ def create_dag(self, config, **kwargs):
pulsars = []
for parfile in parfiles:
# add "*.par" wildcard to any directories
if os.path.isdir(parfile):
parfile = os.path.join(parfile, "*.par")
if Path(parfile).is_dir():
parfile = Path(parfile).rglob("*.par")
else:
parfile = [Path(parfile)]

# get all parameter files
pulsars.extend(
[
par
for par in glob.glob(parfile)
if os.path.splitext(par)[1] == ".par"
]
[str(par) for par in parfile if par.suffix == ".par"]
)

# get names of all the pulsars
Expand Down

0 comments on commit 1d1d21f

Please sign in to comment.