Created
February 2, 2024 00:39
-
-
Save andycasey/6f744b4a3d4e26d608a2e72d8fe02f82 to your computer and use it in GitHub Desktop.
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
# Example to sample from the observed quantities and run each sample through StarFit | |
# In this example we will say that we have the following abundances: | |
# [C/Fe] = -1.1 +/- 0.2 | |
# [N/Fe] = -0.5 +/- 0.1 | |
# [Mg/Fe] < 0.3 | |
# Whenever you're generating random numbers, you should always "seed" the random number generator. | |
# That way you'll still get "random"-esque numbers, but if you run your code twice you will get the same "random" numbers. | |
# If the numbers were really random each time you ran the code then it would be difficult to debug things. | |
import numpy as np | |
np.random.seed(314159) # pick your favourite magic number | |
c_fe = np.random.normal(-1.1, 0.2) | |
n_fe = np.random.normal(-0.5, 0.1) | |
mg_fe = np.random.uniform(-12, 0.3) # here -12 is just some very unrealistically low value | |
# Then you can repeat this process many times (~100) and see how much the StarFit results vary. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment