Loading repository data…
Loading repository data…
perwin / repository
Data files, code, and Jupyter notebooks for paper on frequency of bars in spiral galaxies, using S4G data
This git repository contains data files, Python code, and Python and R Jupyter notebooks which can be used to reproduce figures and analyses from the paper "The Dependence of Bar Frequency on Galaxy Mass, Colour, and Gas Content -- and Angular Resolution -- in the Local Universe" (Erwin 2018, Monthly Notices of the Royal Astronomical Society, 474: 5372; arXiv:1711.04867).
The data/ subdirectory contains text-file tables with various data compilations
and simulation outputs; see the README.md file there for details.
(This figure, reproduced from the paper, shows the fraction of spiral galaxies which have bars, as a function of stellar mass, for the local, S4G-based sample studied in the paper (red circles), as well as for several SDSS-based studies. The blue pentagons show what would happen if the same S4G-based sample were to be observed at redshifts typical of the SDSS-based studies, assuming that only bars with projected semi-major axes more than twice size of the typical PSF FWHM can be detected.)
The Python code and notebooks require the following Python modules and packages:
cap_loess_1dThe R notebooks require the survey and zoo packages.
There are three Python notebooks:
s4gbars_main.ipynb -- generates the largest set of figures in the paper; also generates
data files for use in R logistic regression
s4gbars_barsizes.ipynb -- generates figures which use S4G (and sometimes Galaxy
Zoo 2) bar sizes
s4gbars_simulated_surveys.ipynb -- generates figures using the output of survey
simulations (which are themselves generated by the Python script make_simulated_surveys.py)
There are also two R notebooks:
s4gbars_R_logistic_regression.ipynb -- runs the logistic regression analyses
used for the paper (e.g., Sections 3.1, 3.2, 3.3, and 6.1 and Table 3).
s4gbars_R_quantile-loess.ipynb -- generates text files containing quantile
LOESS curves for bar sizes, used in Figure 8 of the paper.
datautils.py, plotutils.py, s4gutils.py -- miscellaneous utility functions
(including statistics).
simulate_surveys.py -- code for generating bootstrapped mock surveys measuring bar frequencies,
using the S4G galaxies as a parent sample and adopting user-specified redshift ranges.
make_simulated_surveys.py -- executable script generating specific mock surveys
using the code in simulate_surveys.py:
The outputs of this script (using the default random seed value of 100) can be found in the data/ subdirectory.
generate_GZ2-bar-sizes_table.py -- code for regenerating the GZ2 bar-sizes table
in the data/ subdirectory (note that running this will required downloading the
GZ2 SDSS metadata table from the GZ data site; see notes in the data/external/
subdirectory).
Download this repository (some individual notebooks can be run with only a subset of the data files and code, but it's simpler just to work with the entire set of files).
Run the Python notebooks (s4gbars_main.ipynb, s4gbars_barsizes.ipynb, s4gbars_simulated_surveys.ipynb)
to re-generate the figures, or to experiment with alternative versions.
To re-run the SDSS survey simulations, use the make_simulated_surveys.py script,
which will regenerate the output sim_* files in data/ subdirectory (using the same
random seed as was used for the paper). To change the
random seed for the simulations, edit the make_simulated_surveys.py script and
change the value assigned to the randomSeed variable; to use the current time as
the seed, set randomSeed = None.
To re-do the logistic regression analyses, run the R notebook s4gbars_R_logistic_regression.ipynb.
Code in this repository is released under the BSD 3-clause license.