Skip to content

Commit bbabaaa

Browse files
committed
Comments verwerkt
1 parent 785b329 commit bbabaaa

File tree

4 files changed

+12
-27
lines changed

4 files changed

+12
-27
lines changed

dedisperse/dedisperse.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# pylint: disable-msg=C0103
55
import numpy as np
66

7-
def dedisperse(samples, highest_x=None, max_delay=0, dm=None):
7+
def dedisperse(samples, highest_x=None, max_delay=0, disperion_measure=None):
88
'''
99
This method performs dedispersion on the filterbank data
1010
The maximum_delay specifies between the currently considered pulsar signal and the next pulsar
@@ -13,14 +13,14 @@ def dedisperse(samples, highest_x=None, max_delay=0, dm=None):
1313
pulsar intensity
1414
'''
1515

16-
# Check if parameters contain a DM, if not, estimate one
17-
if dm is None:
16+
# Check if parameters contain a Dispersion Measure, if not, estimate one
17+
if disperion_measure is None:
1818
# Estimates the minimum for an intensity to be considered a pulsar
1919
pulsar_intensity = find_estimation_intensity(samples, highest_x)
20-
dm = find_dm(samples, pulsar_intensity, max_delay)
20+
disperion_measure = find_dm(samples, pulsar_intensity, max_delay)
2121

22-
# Distribute the DM over the amount of samples
23-
delays_per_sample = (np.round(np.linspace(dm, 0, samples.shape[1]))).astype(int)
22+
# Distribute the Dispersion Measure over the amount of samples
23+
delays_per_sample = np.round(np.linspace(disperion_measure, 0, samples.shape[1])).astype(int)
2424

2525
# Loop over the frequencies
2626
for i, _ in enumerate(delays_per_sample):
@@ -54,8 +54,8 @@ def find_dm(samples, pulsar_intensity, max_delay):
5454

5555
# If a line is found, calculate and return the dispersion measure
5656
if line_coordinates is not None:
57-
dm = line_coordinates[1] - line_coordinates[0]
58-
return dm
57+
disperion_measure = line_coordinates[1] - line_coordinates[0]
58+
return disperion_measure
5959

6060
return None
6161

examples/dedisperse_stream.py

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -23,21 +23,6 @@
2323
highest_x=10
2424
max_delay=10
2525

26-
# Files with low signal to noise ratio
27-
# special_pspm = fb.Filterbank(filename = "../data/my_uber_pspm.fil")
28-
# highest_x=10
29-
# max_delay=10
30-
31-
# File with 10000 samples
32-
# special_pspm = fb.Filterbank(filename = "../data/pspm_4_2.fil")
33-
# highest_x=10
34-
# max_delay=100
35-
36-
# File with 10000 samples with low signal to noise ratio
37-
# special_pspm = fb.Filterbank(filename = "../data/pspm_4_1.fil")
38-
# highest_x=10
39-
# max_delay=100
40-
4126
special_pspm.read_filterbank()
4227

4328
frequencies, samples = special_pspm.select_data()

pipeline/pipeline.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,13 +112,13 @@ def measure_methods(self, stopwatch, fil_data, freqs, DM, scale):
112112
Run and time all methods/modules
113113
"""
114114
# clipping
115-
115+
116116
time_clipping = timer()
117117
_, _ = clipping.clipping(freqs, fil_data)
118118
stopwatch['time_clipping'] = timer() - time_clipping
119119
# dedisperse
120120
time_dedisp = timer()
121-
fil_data = dedisperse.dedisperse(fil_data, dm=DM)
121+
fil_data = dedisperse.dedisperse(fil_data, disperion_measure=DM)
122122
stopwatch['time_dedisp'] = timer() - time_dedisp
123123
# timeseries
124124
time_t_series = timer()

tests/test_dedisperse.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"""
44

55
import unittest
6-
import numpy as np
6+
import numpy as np
77

88
from .context import dedisperse # pylint: disable-msg=E0611
99

@@ -26,5 +26,5 @@ def test_dedisperse(self):
2626
expect moved frequencies per sample
2727
"""
2828
disp_measure = 6
29-
results = dedisperse.dedisperse(np.array(self.samples), None, None, disp_measure)
29+
results = dedisperse.dedisperse(np.array(self.samples), disperion_measure=disp_measure)
3030
self.assertListEqual(list(results[len(self.samples)-1]), [10]*7)

0 commit comments

Comments
 (0)