aboutsummaryrefslogtreecommitdiffstats
path: root/mass_profile/shuffle_profile.py
diff options
context:
space:
mode:
Diffstat (limited to 'mass_profile/shuffle_profile.py')
-rwxr-xr-xmass_profile/shuffle_profile.py37
1 files changed, 0 insertions, 37 deletions
diff --git a/mass_profile/shuffle_profile.py b/mass_profile/shuffle_profile.py
deleted file mode 100755
index 124f505..0000000
--- a/mass_profile/shuffle_profile.py
+++ /dev/null
@@ -1,37 +0,0 @@
-#!/usr/bin/env python3
-#
-# Shuffle the profile data point values according to their errors.
-#
-# Weitian LI
-# 2017-02-07
-
-import sys
-import numpy as np
-
-
-if len(sys.argv) != 3:
- print("Usage: %s <input_profile> <shuffled_profile>")
- sys.exit(1)
-
-
-# 4-column data: radius, err, temperature/brightness, err
-data = np.loadtxt(sys.argv[1])
-
-x1 = data[:, 2]
-xe = data[:, 3]
-x2 = np.zeros(shape=x1.shape)
-
-for i in range(len(x2)):
- if x1[i] <= 0 or xe[i] <= 0:
- # Skip shuffle
- x2[i] = x1[i]
-
- v = -1.0
- while v <= 0:
- v = np.random.normal(0.0, 1.0) * xe[i] + x1[i]
- x2[i] = v
-
-# Replace original values
-data[:, 2] = x2
-
-np.savetxt(sys.argv[2], data)