-
Notifications
You must be signed in to change notification settings - Fork 3
Separate bifrost module acorr calculates auto-correlations and is inc… #20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
adampbeardsley
wants to merge
1
commit into
main
Choose a base branch
from
hari_pr
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -50,6 +50,12 @@ | |||||||||
| from lsl.reader.ldp import TBNFile, TBFFile | ||||||||||
| from lsl.common.stations import lwasv | ||||||||||
|
|
||||||||||
| #Bifrost include Hari's upgrades | ||||||||||
| from bifrost.xCorr import xCorr | ||||||||||
| from bifrost.aCorr import aCorr | ||||||||||
| from bifrost.VGrid import VGrid | ||||||||||
|
|
||||||||||
|
|
||||||||||
| # some py2/3 compatibility | ||||||||||
| if sys.version_info.major < 3: | ||||||||||
| range = xrange # noqa | ||||||||||
|
|
@@ -740,8 +746,8 @@ def main(self): | |||||||||
| ishape = (self.ntime_gulp, nchan, nstand, npol) | ||||||||||
| ogulp_size = self.ntime_gulp * self.nchan_out * nstand * self.npol_out * 1 # ci4 | ||||||||||
| oshape = (self.ntime_gulp, self.nchan_out, nstand, self.npol_out) | ||||||||||
| self.iring.resize(igulp_size) | ||||||||||
| self.oring.resize(ogulp_size) # , obuf_size) | ||||||||||
| self.iring.resize(igulp_size, buffer_factor=8) | ||||||||||
| self.oring.resize(ogulp_size, buffer_factor=512) # , obuf_size) | ||||||||||
|
|
||||||||||
| ohdr = ihdr.copy() | ||||||||||
| ohdr["nchan"] = self.nchan_out | ||||||||||
|
|
@@ -970,8 +976,8 @@ def main(self): | |||||||||
|
|
||||||||||
| oshape = (1, nchan, npol ** 2, self.grid_size, self.grid_size) | ||||||||||
| ogulp_size = nchan * npol ** 2 * self.grid_size * self.grid_size * 8 | ||||||||||
| self.iring.resize(igulp_size) | ||||||||||
| self.oring.resize(ogulp_size, buffer_factor=5) | ||||||||||
| self.iring.resize(igulp_size, buffer_factor=512) | ||||||||||
| self.oring.resize(ogulp_size, buffer_factor=32) | ||||||||||
| prev_time = time.time() | ||||||||||
| with oring.begin_sequence(time_tag=iseq.time_tag, header=ohdr_str) as oseq: | ||||||||||
| iseq_spans = iseq.read(igulp_size) | ||||||||||
|
|
@@ -1126,13 +1132,30 @@ def main(self): | |||||||||
| space="cuda", | ||||||||||
| ) | ||||||||||
|
|
||||||||||
| ## Auto-Correlation of Antennas | ||||||||||
| if self.benchmark == True: | ||||||||||
| timeacorr1 = time.time() | ||||||||||
|
|
||||||||||
| try: | ||||||||||
| bf_acorr.execute(udata, autocorrs) | ||||||||||
| except NameError: | ||||||||||
| bf_acorr = aCorr() | ||||||||||
| bf_acorr.init(self.locs, polmajor=False) | ||||||||||
| bf_acorr.execute(udata, autocorrs) | ||||||||||
|
|
||||||||||
| if self.benchmark == True: | ||||||||||
| timeacorr2 = time.time() | ||||||||||
| print("Auto-Corr time : %f"%(timeacorr2 - timeacorr1)) | ||||||||||
|
|
||||||||||
|
|
||||||||||
|
|
||||||||||
| # Cross multiply to calculate autocorrs | ||||||||||
| bifrost.map( | ||||||||||
| "a(i,j,k,l) += (b(i,j,k,l/2) * b(i,j,k,l%2).conj())", | ||||||||||
| {"a": autocorrs, "b": udata, "t": self.ntime_gulp}, | ||||||||||
| axis_names=("i", "j", "k", "l"), | ||||||||||
| shape=(self.ntime_gulp, nchan, nstand, npol ** 2), | ||||||||||
| ) | ||||||||||
| #bifrost.map( | ||||||||||
| # "a(i,j,k,l) += (b(i,j,k,l/2) * b(i,j,k,l%2).conj())", | ||||||||||
| # {"a": autocorrs, "b": udata, "t": self.ntime_gulp}, | ||||||||||
| # axis_names=("i", "j", "k", "l"), | ||||||||||
| # shape=(self.ntime_gulp, nchan, nstand, npol ** 2), | ||||||||||
| #) | ||||||||||
|
|
||||||||||
| bifrost.map( | ||||||||||
| "a(i,j,p,k,l) += b(0,i,j,p/2,k,l)*b(0,i,j,p%2,k,l).conj()", | ||||||||||
|
|
@@ -1432,9 +1455,9 @@ def main(self): | |||||||||
| # sys.exit(1) | ||||||||||
|
|
||||||||||
| oshape = (nchan, npol ** 2, self.skymodes, 1) | ||||||||||
| ogulp_size = nchan * npol**2 * self.skymodes * 8 | ||||||||||
| self.iring.resize(igulp_size) | ||||||||||
| self.oring.resize(ogulp_size, buffer_factor=5) | ||||||||||
| ogulp_size = nchan * npol**2 * self.skymodes * 32#8 | ||||||||||
| self.iring.resize(igulp_size, buffer_factor=512) | ||||||||||
| self.oring.resize(ogulp_size, buffer_factor=32) | ||||||||||
| prev_time = time.time() | ||||||||||
| with oring.begin_sequence(time_tag=iseq.time_tag, header=ohdr_str) as oseq: | ||||||||||
| iseq_spans = iseq.read(igulp_size) | ||||||||||
|
|
@@ -2165,10 +2188,10 @@ def main(): | |||||||||
| print("Output directory does not exist. Defaulting to current directory.") | ||||||||||
| args.out_dir = "." | ||||||||||
|
|
||||||||||
| if args.removeautocorrs: | ||||||||||
| raise NotImplementedError( | ||||||||||
| "Removing autocorrelations is not yet properly implemented." | ||||||||||
| ) | ||||||||||
| #if args.removeautocorrs: | ||||||||||
| # raise NotImplementedError( | ||||||||||
| # "Removing autocorrelations is not yet properly implemented." | ||||||||||
| # ) | ||||||||||
|
Comment on lines
+2191
to
+2194
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||
|
|
||||||||||
| log = logging.getLogger(__name__) | ||||||||||
| logFormat = logging.Formatter( | ||||||||||
|
|
@@ -2182,8 +2205,9 @@ def main(): | |||||||||
| log.setLevel(logging.DEBUG) | ||||||||||
|
|
||||||||||
| # Setup the cores and GPUs to use | ||||||||||
| cores = [0, 2, 3, 4, 5, 6, 7] | ||||||||||
| #cores = [0, 2, 3, 4, 5, 6, 7] | ||||||||||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||
| gpus = [0, 0, 0, 0, 0, 0, 0] | ||||||||||
| cores = [5, 4, 3, 2, 24, 25] | ||||||||||
|
|
||||||||||
| # Setup the signal handling | ||||||||||
| ops = [] | ||||||||||
|
|
||||||||||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.