added option to report probability density
This commit is contained in:
parent
e9ec497da6
commit
3e6d2710a3
|
@ -34,7 +34,11 @@ parser.add_option('-N',
|
||||||
dest = 'N',
|
dest = 'N',
|
||||||
type = 'int', metavar = 'int',
|
type = 'int', metavar = 'int',
|
||||||
help = 'number of bins')
|
help = 'number of bins')
|
||||||
parser.add_option('-l', '--logarithmic',
|
parser.add_option('--density',
|
||||||
|
dest = 'density',
|
||||||
|
action = 'store_true',
|
||||||
|
help = 'report probability density')
|
||||||
|
parser.add_option('--logarithmic',
|
||||||
dest = 'log',
|
dest = 'log',
|
||||||
action = 'store_true',
|
action = 'store_true',
|
||||||
help = 'logarithmically spaced bins')
|
help = 'logarithmically spaced bins')
|
||||||
|
@ -42,6 +46,7 @@ parser.set_defaults(data = None,
|
||||||
weights = None,
|
weights = None,
|
||||||
range = None,
|
range = None,
|
||||||
N = None,
|
N = None,
|
||||||
|
density = False,
|
||||||
log = False,
|
log = False,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -110,6 +115,7 @@ for name in filenames:
|
||||||
(forward(rangeMax)-forward(rangeMin))/options.N),
|
(forward(rangeMax)-forward(rangeMin))/options.N),
|
||||||
range = (rangeMin,rangeMax),
|
range = (rangeMin,rangeMax),
|
||||||
weights = None if options.weights is None else table.data[:,1],
|
weights = None if options.weights is None else table.data[:,1],
|
||||||
|
density = options.density,
|
||||||
)
|
)
|
||||||
bincenter = reverse(forward(rangeMin) + (0.5+np.arange(options.N)) *
|
bincenter = reverse(forward(rangeMin) + (0.5+np.arange(options.N)) *
|
||||||
(forward(rangeMax)-forward(rangeMin))/options.N) # determine center of bins
|
(forward(rangeMax)-forward(rangeMin))/options.N) # determine center of bins
|
||||||
|
|
Loading…
Reference in New Issue