FoFpy


NameFoFpy JSON
Version 1.0.4 PyPI version JSON
download
home_page
SummaryPython package to perform group finding in redshift surveys.
upload_time2023-02-01 06:54:10
maintainer
docs_urlNone
author
requires_python>=3.10
license
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # pyFoF
Python package to perform group finding in redshift surveys.

## Installation

### Via Pip

pyFoF is pip installable. One can simply run,

```
pip install FoFpy
```

Note that it is important to make sure the package is spelled correctly and with proper case sensitivity so as to not conflict with similarly named packages in other domain areas. Specifically, while the repository name is pyFoF, the deployed and installable package is named Fofpy. We are busy working on refactoring the repository to resolve this name conflict and subsequent mismatch.

### Via Source

To install pyFoF from source, first we download the repository using git,

```bash
git clone https://github.com/TrystanScottLambert/pyFoF.git
```

Then once we've cloned the repo, we will change directory into the pyFoF folder using,

```bash
cd pyFoF
```

Following this, we need only run,

```bash
pip3 install .
```

Remember to test your installation using the example provided in the sections below.

## How PyFoF Works

Pyfof finds galaxy groups using a modified version of the friends-of-friends algorithm (Huchra et. al., 1982). This is the same modified version which was used to create the 2MRS galaxy-group catalog (Lambert et. al., 2020). This modified version tries to correct for two main short-commings of the original friends-of-friends algorithm: The over-reliance on the---ultimately unjustifiable---pair of linking lengths, and the fact that the order in which the algorithm is run results in different outputs.

The modified version runs the original algorithm multiple times and averages the results using graph-theory, but varies the linking lengths for each run. This allows the algorithm to instead build a group cataog by using an area of parameter space instead of trying to justify any particular set of linking lengths. Each run of the original algorithm produces a group-catalog and these group catalogs are used to build one master graph where each node represents a galaxy and each edge represents how many times that galaxy was found in a group with the connecting galaxy. Once this main graph has been generated, a selection can be performed, removing all edges below a certain threshold. This threshold is left to the user to decide. Lambert et. al., (2020) justified a 0.5 cut. Once the cut is down the final group catalog is generated by finding all connected subgraphs of the main graph and only selecting groups with 3 or more members.

## Example

First lets import the package. 
```python
import pyfof
from astropy.cosmology import FlatLambdaCDM
```

We will use the KIDS survey as an example. This file is saved as: Kids_S_hemispec_no_dupes_updated.tbl and has the columns ra, dec, vel and the wise magnitudes---dentoted as w1. A cosmology must be decided upon before using running the group finder, astropy provides a useful cosmology package which pyfof reads. Most of the time FlatLambdaCDM should be sufficient. 

```python
cosmo = FlatLambdaCDM(H0=70, Om0=0.3)
```

We have included a data_handling module to read in catalogs stored as fits files or as standard IAUPAC tables. The minimum number of columns required is ra, dec, velocity, and magnitudes. Although, the read_data function will create a data object weather or not these columns exist, but the program will not run without them. 

```python
from pyfof.datahandling import read_data
INFILE = 'Kids_S_hemispec_no_dupes_updated.tbl'
data = read_data(INFILE)
```

We must create a "Survey" Object where we will pass the cosmology that was decided apon as well as the parameters of the Schecter function that the user wishes to use. If no shecter parameters are used then the default parameters, suggested in Kochanek et. al., (2001): α = −1.02, M∗ = −24.2 mag, and Φ∗ = 0.42×10−2 Mpc-3. The apparent-magnitude-limit of the survey needs to also be given. If this isn't set by the design of the survey, then either the smallest magnitude can be used, or any another reasonable minimum (such as the 3 sigma of a guassian).

```python
from pyfof.survey import Survey
KIDS = Survey(data, cosmo, 18.)
```

The survey object has a helper function to convert columns from redshift to cz (using the cosmology)---in case that the latter is the given column. Doing this will create a new column in the Survey object with the correct naming. 

```python
KIDS.convert_z_into_cz('z_helio')
```

Once a survey has been created with the correct four columns with the case-sensitive names ra, dec, vel, and mag, the program be run: 

```python
    run = pyfof.Experiment(
        d0_initial=0.3, d0_final=0.8,
        v0_initial=100, v0_final=500,
        d_max=2., v_max=1000,
        n_trials=10, cutoff=0.5, survey = KIDS
        )
```

The parameters which must be passed are the initial and final linking lenghts (v0 and d0), the max allowable value for the d0 linking length and the max value for the v0 linking lengths, the number of trials to run (note that these trials will be run in parrallel), the final cutoff that will happen after averaging all the results and the survey to run on. 

After this has been run we can write the results as ascii files. Two files will be produced, a galaxy catalog with the galaxy information data and a group catalog with galaxy-group data. Importantly this will have a galaxy id column which can be used to find the associate members in the galaxy catalog. 

```python
run.write_all_catalogs(overwrite = True)
```

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "FoFpy",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.10",
    "maintainer_email": "",
    "keywords": "",
    "author": "",
    "author_email": "Trystan Scott Lambert <trystanscottlambert@gmail.com>, Victor Gueorguiev Gueorguiev <victor.gueorg@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/d3/ed/9ee527b301b62415d383737ec8940ff8fd3a6cb41e52179c24a2a04a91f5/FoFpy-1.0.4.tar.gz",
    "platform": null,
    "description": "# pyFoF\nPython package to perform group finding in redshift surveys.\n\n## Installation\n\n### Via Pip\n\npyFoF is pip installable. One can simply run,\n\n```\npip install FoFpy\n```\n\nNote that it is important to make sure the package is spelled correctly and with proper case sensitivity so as to not conflict with similarly named packages in other domain areas. Specifically, while the repository name is pyFoF, the deployed and installable package is named Fofpy. We are busy working on refactoring the repository to resolve this name conflict and subsequent mismatch.\n\n### Via Source\n\nTo install pyFoF from source, first we download the repository using git,\n\n```bash\ngit clone https://github.com/TrystanScottLambert/pyFoF.git\n```\n\nThen once we've cloned the repo, we will change directory into the pyFoF folder using,\n\n```bash\ncd pyFoF\n```\n\nFollowing this, we need only run,\n\n```bash\npip3 install .\n```\n\nRemember to test your installation using the example provided in the sections below.\n\n## How PyFoF Works\n\nPyfof finds galaxy groups using a modified version of the friends-of-friends algorithm (Huchra et. al., 1982). This is the same modified version which was used to create the 2MRS galaxy-group catalog (Lambert et. al., 2020). This modified version tries to correct for two main short-commings of the original friends-of-friends algorithm: The over-reliance on the---ultimately unjustifiable---pair of linking lengths, and the fact that the order in which the algorithm is run results in different outputs.\n\nThe modified version runs the original algorithm multiple times and averages the results using graph-theory, but varies the linking lengths for each run. This allows the algorithm to instead build a group cataog by using an area of parameter space instead of trying to justify any particular set of linking lengths. Each run of the original algorithm produces a group-catalog and these group catalogs are used to build one master graph where each node represents a galaxy and each edge represents how many times that galaxy was found in a group with the connecting galaxy. Once this main graph has been generated, a selection can be performed, removing all edges below a certain threshold. This threshold is left to the user to decide. Lambert et. al., (2020) justified a 0.5 cut. Once the cut is down the final group catalog is generated by finding all connected subgraphs of the main graph and only selecting groups with 3 or more members.\n\n## Example\n\nFirst lets import the package. \n```python\nimport pyfof\nfrom astropy.cosmology import FlatLambdaCDM\n```\n\nWe will use the KIDS survey as an example. This file is saved as: Kids_S_hemispec_no_dupes_updated.tbl and has the columns ra, dec, vel and the wise magnitudes---dentoted as w1. A cosmology must be decided upon before using running the group finder, astropy provides a useful cosmology package which pyfof reads. Most of the time FlatLambdaCDM should be sufficient. \n\n```python\ncosmo = FlatLambdaCDM(H0=70, Om0=0.3)\n```\n\nWe have included a data_handling module to read in catalogs stored as fits files or as standard IAUPAC tables. The minimum number of columns required is ra, dec, velocity, and magnitudes. Although, the read_data function will create a data object weather or not these columns exist, but the program will not run without them. \n\n```python\nfrom pyfof.datahandling import read_data\nINFILE = 'Kids_S_hemispec_no_dupes_updated.tbl'\ndata = read_data(INFILE)\n```\n\nWe must create a \"Survey\" Object where we will pass the cosmology that was decided apon as well as the parameters of the Schecter function that the user wishes to use. If no shecter parameters are used then the default parameters, suggested in Kochanek et. al., (2001): \u03b1 = \u22121.02, M\u2217 = \u221224.2 mag, and \u03a6\u2217 = 0.42\u00d710\u22122 Mpc-3. The apparent-magnitude-limit of the survey needs to also be given. If this isn't set by the design of the survey, then either the smallest magnitude can be used, or any another reasonable minimum (such as the 3 sigma of a guassian).\n\n```python\nfrom pyfof.survey import Survey\nKIDS = Survey(data, cosmo, 18.)\n```\n\nThe survey object has a helper function to convert columns from redshift to cz (using the cosmology)---in case that the latter is the given column. Doing this will create a new column in the Survey object with the correct naming. \n\n```python\nKIDS.convert_z_into_cz('z_helio')\n```\n\nOnce a survey has been created with the correct four columns with the case-sensitive names ra, dec, vel, and mag, the program be run: \n\n```python\n    run = pyfof.Experiment(\n        d0_initial=0.3, d0_final=0.8,\n        v0_initial=100, v0_final=500,\n        d_max=2., v_max=1000,\n        n_trials=10, cutoff=0.5, survey = KIDS\n        )\n```\n\nThe parameters which must be passed are the initial and final linking lenghts (v0 and d0), the max allowable value for the d0 linking length and the max value for the v0 linking lengths, the number of trials to run (note that these trials will be run in parrallel), the final cutoff that will happen after averaging all the results and the survey to run on. \n\nAfter this has been run we can write the results as ascii files. Two files will be produced, a galaxy catalog with the galaxy information data and a group catalog with galaxy-group data. Importantly this will have a galaxy id column which can be used to find the associate members in the galaxy catalog. \n\n```python\nrun.write_all_catalogs(overwrite = True)\n```\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "Python package to perform group finding in redshift surveys.",
    "version": "1.0.4",
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "367772a00ed754734237d9a3d5ec0cb18c69cf50dd594f782f7eec0e3d2af277",
                "md5": "83ad8c134bad6f01e810f95c65e1be51",
                "sha256": "3ce9b92aceeca5d2343e57b9544992be451f4679cbff91fcf965d31a2347dd16"
            },
            "downloads": -1,
            "filename": "FoFpy-1.0.4-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "83ad8c134bad6f01e810f95c65e1be51",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.10",
            "size": 4392,
            "upload_time": "2023-02-01T06:54:08",
            "upload_time_iso_8601": "2023-02-01T06:54:08.554896Z",
            "url": "https://files.pythonhosted.org/packages/36/77/72a00ed754734237d9a3d5ec0cb18c69cf50dd594f782f7eec0e3d2af277/FoFpy-1.0.4-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "d3ed9ee527b301b62415d383737ec8940ff8fd3a6cb41e52179c24a2a04a91f5",
                "md5": "a534e690626da9f300dd04a1598c5085",
                "sha256": "96092a264bddfd30eb86355bde75ae7e9daf8139db6ceee0425671bd25abe15d"
            },
            "downloads": -1,
            "filename": "FoFpy-1.0.4.tar.gz",
            "has_sig": false,
            "md5_digest": "a534e690626da9f300dd04a1598c5085",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.10",
            "size": 4404,
            "upload_time": "2023-02-01T06:54:10",
            "upload_time_iso_8601": "2023-02-01T06:54:10.081804Z",
            "url": "https://files.pythonhosted.org/packages/d3/ed/9ee527b301b62415d383737ec8940ff8fd3a6cb41e52179c24a2a04a91f5/FoFpy-1.0.4.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-02-01 06:54:10",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "lcname": "fofpy"
}
        
Elapsed time: 0.03362s