-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
64 additions
and
3 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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 |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import numpy as np | ||
|
||
|
||
def powerspace(start, stop, power_slope, size): | ||
""" | ||
Parameters | ||
---------- | ||
start : float | ||
Lower limit of the space. | ||
stop : float | ||
Upper limit of the space. | ||
power_slope : float | ||
Slope of the power law. | ||
size : int | ||
The number of samples. | ||
Returns | ||
------- | ||
x : array_like | ||
Values between 'start' and 'stop' spaced to histogram a power law | ||
with slope 'power_slope' in equal amounts in each bin. | ||
""" | ||
# Adopted from CORSIKA | ||
rd = np.linspace(0.0, 1.0, size) | ||
if power_slope != -1.0: | ||
ll = start ** (power_slope + 1.0) | ||
ul = stop ** (power_slope + 1.0) | ||
slex = 1.0 / (power_slope + 1.0) | ||
return (rd * ul + (1.0 - rd) * ll) ** slex | ||
else: | ||
ll = stop / start | ||
return start * ll**rd |
This file contains 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 |
---|---|---|
@@ -1 +1 @@ | ||
__version__ = "0.0.11" | ||
__version__ = "0.0.12" |