fidanka
Python package for finding fiducual lines on a CMD and for fitting isochrones to fiducual lines.
Science Score: 44.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
✓CITATION.cff file
Found CITATION.cff file -
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
○DOI references
-
○Academic publication links
-
○Academic email domains
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (18.6%) to scientific vocabulary
Keywords
Repository
Python package for finding fiducual lines on a CMD and for fitting isochrones to fiducual lines.
Basic Info
Statistics
- Stars: 9
- Watchers: 3
- Forks: 2
- Open Issues: 0
- Releases: 1
Topics
Metadata Files
README.md
Fidanka
Fidanka is an (hopefully) easy to use python package for doing science with globular clusters. Written by Emily M. Boudreaux and Martin Ying.
Docs & Information
The full API Documentation can be found here.
A short presentation which I've given on fidanka may be found here
Install
PyPi
Fidnka will be avalible on PyPi soon; however, it is not currently avalible anywhere other than GitHub.
From Source (latest)
bash
git clone https://github.com/tboudreaux/fidanka.git
cd fidanka
pip install .
Development
In order to develop for fidanka it will be helpful to also install a few more packages. We also recommend you work in a virtual environment.
Moreover, you must work in your own fork of fidanka and issue pull requests. First fork fidanka on GitHub.
bash
conda create --name fidankaDev python=3
pip install pre-commit
pip install commitizen
git clone https://github.com/<your-username>/fidanka.git
pip install -e .
pre-commit install
pre-commit autoupdate
While use commitizen is not required when contributing, it is highly encouraged.
If you do use commitizen then the add commit workflow is as follows
bash
git add <files>
cz c
Contributing
We welcome any contributions made to this project. Please work in a fork and submit a pull request. We also request that you use the pre-commit hooks we have defined and commit using commitizen. This will help us keep a cleaner channelog. Finally, any contributors to this project are expected to behave in accordance with the code of conduct (codeofconduct.md). Any violation of this will result in a ban on contributions and an evaluation of whether previous contributions should be purged.
Examples
Measuring the fiducial lines of a cluster with multiple populations
Assuming you have your photometry stored in some data structure (here I retrieve it from a pickle as a pandas dataframe), and you have a prior that there are 2 populations within the cluster, you can measure those fiducial lines as follows
This measurement will re-sample the data 1000 times and remeasure the fiducial lines each time in order to get confidence intervals and a mean. ```python from fidanka.fiducial import measurefiduciallines import pickle as pkl
PHOTROOT = "photometry.pkl" with open(PHOTROOT, 'rb') as f: photometry = pkl.load(f)[1]
MC = 1000 fiducialLine = measurefiduciallines( photometry["F275W"], photometry["F814W"], photometry["F275WRMS"], photometry["F814WRMS"], reverseFilterOrder=True, mcruns=MC, nPops = 2 ) popA = fiducialLine[0] popB = fiducialLine[1]
popAMean = popA.mean popA5th = popA.confidence(0.05) popA95th = popA.confidence(0.95)
with open('fldump-sorted.pkl', 'wb') as f: pkl.dump(fiducialLine, f) ```
Fitting an Isochrone
Imagine a file called HUGS1.csv which contains photometry and can be read with pandas for the globular cluster NGC 2808 in your current working directory. Also imagine an isochrone called iso.txt (In the MIST format) in the current working directory. We can fit that isochrone to the photometry as follows. Also imagine we still have popA loaded from the previous example. Finally, imagine you have a series of bolometric correction tables in the current directory stored in a folder called "bolTables". These tables should be in the format available on the MIST website.
```python from fidanka.isochrone.MIST import read_iso from fidanka.isofit.fit import optimize
import pandas as pd import re import os
bolFilenames = list(filter(lambda x: re.search("feh[mp]\d+", x), os.listdir("bolTables"))) bolPaths = list(map(lambda x: os.path.join(args.bTabs, x), bolFilenames)) FeH = ...
photometry = pd.readcsv("HUGS1.csv") iso = readiso("ISO/mist.iso")
filter1 = photometry["F275W"] filter2 = photometry["F814W"] error1 = photometry["F275WRMS"] error2 = photometry["F814WRMS"]
bestFitResults = optimize( popA.mean, iso, bolPaths, FeH, filters = ("F275W", "F814W", "F814W") )
print(bestFitResults) ```
logging
fidanka will write some information to stdout; however, more extensive information will be writte to a log file. By default this is called fidanka.log; however, its name and log level can be configured with the get_logger function
```python from fidanka.misc.utils import get_logger import logging
get_logger("rootLoggerName", "testRun.log", clevel=logging.INFO) ```
This will result in much more information being written to std out. The first argument is the name of the logger module and can be whatever you like. The second is the filename for the file handler. There are also keyword arguments clevel, flevel, and level which control the minimum logger level to be written to the console, the file, and either respectively.
Population Synthethis
Assume you have a series of isochrones loaded in a list and you want to generate a 12.5Gyr cluster with 30000 members and a binary fraction of 0.25.
```python from fidanka.population.synthesize import population from fidanka.fiducial.fiducial import measurefiducialline
ARTSTARTEST = "ArtificialStarCalibratedErrorFunctions.pkl" with open("./RMSFuncs.pkl", 'rb') as f: rmsFuncs = pkl.load(f) with open(ARTSTARTEST, 'rb') as f: artStar = pkl.load(f)
targetAge = 12.5e9 n = 30000
pop = population( isos[:2], -0.84, 0.25, lambda x: x-x + targetAge, n, targetAge, targetAge, 0.25, 2, artStar, 9198, 0.17, "F606W" )
Note that the population Synthesis runs when the code
gets here, NOT at population instantiation time
this can also be called with pop.data().
If this function is called multiple times the same results
will be returned for the same object as a cache is used
df = pop.topandas() pop.tocsv("TestPop.csv") ```
Funding and Acknowledgements
We recongnize the support of NASA Grant No. 80NSSC18K0634 in the development of this software.
Owner
- Name: Emily Boudreaux
- Login: tboudreaux
- Kind: user
- Location: Dartmouth College
- Website: emilyboudreaux.com
- Repositories: 50
- Profile: https://github.com/tboudreaux
I am a Fifth Year Graduate Student at Dartmouth College studying Astrophysics. My research focuses on numerical models of stellar evolution.
Citation (CITATION.cff)
cff-version: 1.1.0 message: "If you use this software, please cite it as below." authors: - family-names: "Boudreaux" given-names: "Emily" orcid: "https://orcid.org/0000-0002-2600-7513" - family-names: "Ying" given-names: "Martin" title: fidanka version: 0.5 date-released: 2023-03-13 url: "https://github.com/tboudreaux/fidanka"
GitHub Events
Total
- Watch event: 1
- Push event: 1
- Pull request review event: 1
- Pull request event: 2
- Fork event: 2
Last Year
- Watch event: 1
- Push event: 1
- Pull request review event: 1
- Pull request event: 2
- Fork event: 2
Issues and Pull Requests
Last synced: 9 months ago
All Time
- Total issues: 0
- Total pull requests: 1
- Average time to close issues: N/A
- Average time to close pull requests: 11 days
- Total issue authors: 0
- Total pull request authors: 1
- Average comments per issue: 0
- Average comments per pull request: 0.0
- Merged pull requests: 1
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 0
- Pull requests: 1
- Average time to close issues: N/A
- Average time to close pull requests: 11 days
- Issue authors: 0
- Pull request authors: 1
- Average comments per issue: 0
- Average comments per pull request: 0.0
- Merged pull requests: 1
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
Pull Request Authors
- pjs902 (1)