{ "info": { "author": "Siddhartha Gurung Lopez", "author_email": "sidgurung@cefca.es", "bugtrack_url": null, "classifiers": [ "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python :: 3" ], "description": "# `FLaREON`\n\nIn this Universe everything is neat, even stochasticity.\n\nLyman alpha Resonant Scatter is dominated by random processes.\n\nAlthough there is chaos, there is also an order.\n\n## Authors\n\nSiddhartha Gurung Lopez\n\nAlvaro Orsi\n\nSilvia Bonoli\n\n\n## Publication links:\n\nADS : http://adsabs.harvard.edu/abs/2018arXiv181109630G\n\narXiv : https://arxiv.org/abs/1811.09630\n\n## Origins and motivation\n\nDue to the Lyman alpha Radiative Transfer large complexity, the efforts of understanding it moved from pure analytic studies to the so-called radiative transfer Monte Carlo (RTMC) codes that simulate Lyman alpha photons in arbitrary gas geometries. These codes provide useful information about the fraction of photons that manage to escape and the resulting Lyman alpha line profiles. The RTMC approach has shown to reproduce the observed properties of LAEs.\n\n`FLaREON` is a publicly available `python` package based on a RTMC (Orsi et al. 2012) able to predict large amounts of Lyman alpha line profiles and escape fractions with high accuracy. We designed this code hoping that it helps researches all over the wolrd to get a better understanding of the Universe.\n\n`FLaREON` is **fast** and **simple**. \n\n+ **Fast** : This code is able to predict Lyman alpha escape fractions and line profiles in an unprecedentedly low amount of time. In particular thousands of escape fractions and line profiles can be computed in less than a second of computational time. \n\n+ **Simple** : This code is *One-Line-Running*. Everyone, from a good trained monkey, passing through undergrade studients, to researches with basic python knowlege should be able to use `FLaREON`.\n\nAlthough `FLaREON` is completely open source and is available for everyone, please, if you are using this code ( for whatever reason ) we will be very glad to hear about you and how you are using it. it's just a curiosity and efficiency matter. Maybe we can help you to have a smoother experience with `FLaREON`. For any issue or suggestion, please, contact `sidgurung@cefca.es`. Thank you.\n\n## Installation\n\nThe easiest way to get `FLaREON` in your machine is through `pip`:\n\n`pip install FLaREON`\n\nThis should do the trick. However, you can also install `FLaREON` downloading this repository and running\n\n`pip install .`\n\nin it.\n\nIn order to finish installation and check that everything is working properly, please, opening a `python`/`ipython` terminal and execute:\n\n```python\nimport FLaREON as Lya\n\nLya.Test_Installation( Make_Plots = True )\n```\n\nThis function checks if the pip installation downloaded everything. Then, if the data files are not found it tries to download them. Please, note that you should have about 1GB of free memory in you machine in order to install `FLaREON`. Also note that as ~1GB of data has to be downloaded, it might take some time depending on your internet conection.\n\nAfter Checking that you have got the data in your machine `FLaREON` will check that everyhting works smoothly. For this some escape fractions and line profiles will be computed. The status of the operation should appear in the screen. Everything should get a `Succsess!!`. The only exception is \n\n`Running : Bicone_X_Slab Analytic --> ERROR. HUMAN IS DEAD. MISMATCH!!`\n\nDo not worry. The only reason why you are getting this error is because this algorithm is not implemented yet. Then the function will produce some plots. In case you want to run the tests without plotting just set `Make_Plots = False` when calling the `Lya.Test_Installation`.\n\nThis should be all for the installation. If you find any trouble/bug duruing it, please, contact us at `sidgurung@cefca.es`. Thank you for your patience.\n\n## Hands on the code.\n\n( Assuming everything went smoothly in the installation... )\n\n**Congratulations!!** You have just become one of the few chosen ones in the history of humankind to have the great pleasure of using `FLaREON`.\n\n**The units**: This code uses velocites in km/s , column densities in cm^{-2} and wavelengths in meters.\n\nFirst let's have a look to the dynamical range of the different parameters covered by `FLaREON`. For this we only need to do:\n\n```python\nimport FLaREON as Lya\n\nLya.Print_the_grid_edges()\n```\n\n\n### Predicting thousands of Lyman alpha escape fractions.\n\nLet's move to one of the most powerful products of `FLaREON`: predicting huge amounts of Lyman alpha escape fractions. \n\nIn theory only one line is needed to predict the escape fraction for a thin shell geometry with expasion velocity (V) of 200km/s, logarithmic of column density (logNH) of 19.5 and dust optical depth (ta) of 0.1 :\n\n```python\nf_esc_Arr = Lya.RT_f_esc( 'Thin_Shell' , [ 200 ] , [ 19.5 ] , [ 0.1 ] )\n``` \n\nIn this way `f_esc_Arr` is an Array of 1 dimension and length 1 that contains the predicted escape fraction for this configuration. \n\nHowever, `FLaREON` implements several gas geometries and is optimized to obtain large amount of escape fractions with only one line of code, so lets expand this a little bit more. If we want to compute the escape fraction in a thin shell outflow with the configurations { V , logNH , ta } , { 200 , 19.5 , 0.1 }, { 300 , 20.0 , 0.01 } and { 400 , 20.5 , 0.001 } we could do\n\n```python\nGeometry = 'Thin Shell' # Other options: 'Galactic Wind' or 'Bicone_X_Slab'\n\nV_Arr = [ 200 , 300 , 400 ] # Expansion velocity array in km/s\n\nlogNH_Arr = [ 19.5 , 20.0 , 20.5 ] # Logarithmic of column densities array in cm**-2\n\nta_Arr = [ 0.1 , 0.01 , 0.001 ] # Dust optical depth Array\n\nf_esc_Arr = Lya.RT_f_esc( Geometry , V_Arr , logNH_Arr , ta_Arr ) \n``` \n\nThe variable `f_esc_Arr` is an Array of 1 dimension and length 3 that encloses the escape fractions for the configurations. In particular `f_esc_Arr[i]` is computed using `V_Arr[i]` , `logNH_Arr[i]` and `ta_Arr[i]`.\n\nIf the user wants to change the outflow gas geometry, they only have to do\n\n```python\nGeometry = 'Galactic Wind' # Other options: 'Thin Shell' or 'Bicone_X_Slab'\n\nf_esc_Arr = Lya.RT_f_esc( Geometry , V_Arr , logNH_Arr , ta_Arr ) \n``` \n\nNote that only one geometry can be used at the same time. If you want to compute different escape fractions ( or line profiles ) for different configurations you will need to call `FLaREON` once per geometry. \n\nThese examples show how the `'Thin_Shell'` and `'Galactic_Wind'` geometries work. These geometries have spherical symmetry so there is no Line of Sight (LoS) dependence in the output escape fraction or line profile. However, `FLaREON` implements a non-spherical-symmetric geometry, the `'Bicone_X_Slab'` geometry (for details, again, we refer you to the presentation letter). In this particular geometry the escape fraction (and line profile) depends on the LoS. In particular, if you observed face-on (throught the biconical outflow) the optical depth is lower than observeing edge-on (through the static dense slab).\n\nIn order to tell `FLaREON` the orientation of observation ( edge-on or face-on ) the user needs to provide anther varible when calling the code: `Inside_Bicone_Arr`. If this is not given it is assumed that it's always observed face-on. This variable has to be a boolean array with the same size as `V_Arr` , `logNH_Arr` ot `ta_Arr`. Additionally, the aperture angle of the bicone is 45deg, so to produce a set of escape fractions with random orientations in the biconenical geometry you should use:\n\n```python\nimport numpy as np\n\nGeometry = 'Bicone_X_Slab'\n\nArea_in_bicone = 1. - np.cos( np.pi/4. ) # the apperture angle is pi/4\n\nInside_Bicone_Arr = np.random.rand( len(V_Arr) ) < Area_in_bicone\n\nf_esc_Arr = Lya.RT_f_esc( Geometry , V_Arr , logNH_Arr , ta_Arr , Inside_Bicone_Arr=Inside_Bicone_Arr ) \n``` \n\n#### Deeper options on predicting the escape fraction .\n\nThere are many algorithims implemented to compute `f_esc_Arr`. By default `FLaREON` uses a machine learning decision tree regressor and a parametric equation for the escape fraction as function of the dust optical depth (Go to the `FLaREON` presentation paper Gurung-Lopez et al. in prep for more information). These settings were chosen as default since they give the best performance. However the user might want to change the computing algorithm so here leave a guide with all the available options.\n\n+ `MODE` variable refers to mode in which the escape fraction is computed. There are 3 ways in which `FLaREON` can compute this. i) `'Raw'` Using the raw data from the RTMC (Orsi et al. 2012). ii) `'Parametrization'` Assume a parametric equation between the escape fraction and the dust optical depth that allows to extend calculations outside the grid with the highest accuracy (in `FLaREON`). iii) `'Analytic'` Use of the recalibrated analytic equations presented by Gurung-Lopez et al. 2018. Note that the analytic mode is not enabled in the bicone geometry although it is in the `'Thin_Shel'` and `'Galactic_Wind'`\n\n\n+ `Algorithm` varible determines the technique used. This can be i) `'Intrepolation'`: lineal interpoation is used. ii) `'Machine_Learning'` machine learning is used. To determine which machine learning algorithm you would like to use please, provide the variable `Machine_Learning_Algorithm`. The machine learning algorithms implemented are Decision tree regressor (`'Tree'`), Random forest regressor (`'Forest'`) and KN regressor (`'KN'`). The machine learning is implemented by `Sci-kit-learn`, please, visit their webside for more information (http://scikit-learn.org/stable/).\n\n```python\nMODE = 'Raw' # Other : 'Parametrization' , 'Analytic'\n\nAlgorithm = 'Intrepolation' # Other : 'Machine_Learning'\n\nMachine_Learning_Algorithm = 'KN' # Other 'Tree' , 'Forest'\n\nf_esc_Arr = Lya.RT_f_esc( Geometry , V_Arr , logNH_Arr , ta_Arr , MODE=MODE ) \n``` \n\nFinally, any combination of `MODE` , `Algorithm` and `Machine_Learning_Algorithm` is allowed. However, note that the variable `Machine_Learning_Algorithm` is useless if `Algorithm='Intrepolation'`.\n\n\n### Predicting thousands of Lyman alpha Line profiles.\n\nIn this section we explain how to obtain in a fast way an arbitray number of Lyman alpha line porfiles. The syntax is very similar to the one of escape fraction functions. The main difference is that the user must provide a wavelength array (in meters) where the line profile will be evaluated. The line profile of a thin shell outfow with expansion velocity (V) 200 km/s, logarithmic of column density (logNH) of 19.5 and dust optical depth (ta) of 0.1 in 20 amstrongs arround Lyman alpha can be computed as\n\n```python\nwavelength_Arr = np.linspace( 1215.68 - 20 , 1215.68 + 20 , 1000 ) * 1e-10 # meters, please!\n\nLine_profile_Arr = Lya.RT_Line_Profile( 'Thin_Shell' , wavelength_Arr , [ 200 ] , [ 19.5 ] , [ 0.1 ] )\n```\n\nAs in the case of the escape fraction, in order to compute multiple line profiles at the same time just make\n\n```python\nwavelength_Arr = np.linspace( 1215.68 - 20 , 1215.68 + 20 , 1000 ) * 1e-10 # meters, please!\n\nV_Arr = [ 200 , 300 , 400 ] # Expansion velocity array in km/s\n\nlogNH_Arr = [ 19.5 , 20.0 , 20.5 ] # Logarithmic of column densities array in cm**-2\n\nta_Arr = [ 0.1 , 0.01 , 0.001 ] # Dust optical depth Array\n\nLine_profile_Arr = Lya.RT_Line_Profile( 'Thin_Shell' , wavelength_Arr , V_Arr , logNH_Arr , ta_Arr )\n```\n\n\nIn this case, `Line_profile_Arr` is an array with shape (3,1000) that contains the computed line profiles. In particular `Line_profile_Arr[i,:]` is the line profile evaluated in `wavelength_Arr` computed with `V_Arr[i]` , `logNH_Arr[i]` and `ta_Arr[i]`. \n\nThe other geometries (`'Galactic_Wind'` or `'Bicone_X_Slab'`) are also implemented. In particular, in the biconical geometry it is also possible to chose a line of sight observations. This is implemented in the same way as in the escape fraction. \n\n\nIn opposite to escape fraction calculations, the line profile only supports by now linear interpolation between the pre-computed grids. Machine learning or deep learning might be implement in a future.\n\n\n### A powerfull aliance : Joining FLaREON and emcee.\n\n`emcee` (http://dfm.io/emcee/current/) is a popular `python` package including tool to perform MCMC analysis. \n\nIn the folder `EXAMPLE_MCMC/` we include a basic examplem of how to wrap up `emcee` and `FLaREON`.\n\n`MCMC_fitter.py` is a script that generate a problem line profile and run an MCMC analysis to determine the ( column density - expansion velocty - dust optical depth ) combination that best reproduces the problem line profile. You can find a highly detailed explanation of the how the code works within it. \n\n`MCMC_fitter.py` saves a file with all the MCMC information and name it acordingly to the MCMC configuration used.\n\n`Analize_mcmc.py` is another script to extract information from the saved file. You can set the MCMC parameters inside the code or you might just pass as an argument the name of the saved file:\n\n```python\nipython Analize_mcmc.py mcmc_output_Galactic_Wind_None_ndim_3_nsteps_1000_nwalkers_100.txt\n```\n\nwhere the `mcmc_output_Galactic...txt` is the files saved by `MCMC_fitter.py`. \n\nIn this particular case, `Analize_mcmc.py` prints:\n\n```python\nif the ouflow geometry is Galactic_Wind, then, the best fitting values are...:\n V_exp = 62.4315\n V_exp_err_top = 0.0\n V_exp_err_bot = 0.0\n logNH = 17.14153\n logNH_err_top = 0.0\n logNH_err_bot = 0.0\n logta = -0.250951\n logta_err_top = 0.0\n logta_err_bot = 0.0\n```\n\nwhere `V_exp` , `logNH` and `logta` are the best fitting expansion velocity, logarithm of column density and logarithm of dust optical depth for the line profile produced inside `MCMC_fitter.py` .\n\nWe remark that this is just a simple script to ilustrate how to make a efficient wrap up in `emcee`. Users should develope their own codes to obtain better results on their individual estudies. However, we hope that the structure of `MCMC_fitter.py` can help users.", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/sidgurun/LyaRT-Grid", "keywords": "", "license": "", "maintainer": "", "maintainer_email": "", "name": "FLaREON", "package_url": "https://pypi.org/project/FLaREON/", "platform": "", "project_url": "https://pypi.org/project/FLaREON/", "project_urls": { "Homepage": "https://github.com/sidgurun/LyaRT-Grid" }, "release_url": "https://pypi.org/project/FLaREON/1.0.0/", "requires_dist": null, "requires_python": "", "summary": "Fast Lyman alpha Radiative Transfer for everyone!", "version": "1.0.0" }, "last_serial": 5778102, "releases": { "0.0.3": [ { "comment_text": "", "digests": { "md5": "f5b3ae303ea53ff2a977d9cfa8fa4a6c", "sha256": "98a84ebe7db3c47593c7d1a0bdbb12acf517e44558fd6f4b7a43b5b623cc7446" }, "downloads": -1, "filename": "FLaREON-0.0.3.tar.gz", "has_sig": false, "md5_digest": "f5b3ae303ea53ff2a977d9cfa8fa4a6c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 16046, "upload_time": "2018-10-31T16:56:59", "url": "https://files.pythonhosted.org/packages/74/0e/c5c3fd3e57010e3c9aad61a6f19305281e8be52710b6d8a2eae5c598e7b3/FLaREON-0.0.3.tar.gz" } ], "0.0.4": [ { "comment_text": "", "digests": { "md5": "82990750ad16f3b09c0f8464023d6f81", "sha256": "d408d792c376d6c4d76fda06f44d0951ae230610dfe784a15f3b294380a088d8" }, "downloads": -1, "filename": "FLaREON-0.0.4.tar.gz", "has_sig": false, "md5_digest": "82990750ad16f3b09c0f8464023d6f81", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 16044, "upload_time": "2018-10-31T17:04:54", "url": "https://files.pythonhosted.org/packages/4f/ba/601eafb551afc48c6d95baba601d363d05e5eb87fe58c77292ea50fc2af8/FLaREON-0.0.4.tar.gz" } ], "0.0.5": [ { "comment_text": "", "digests": { "md5": "cacdec600c65650453e3e3a5614ad85c", "sha256": "fe2435fefa79c52c7f2f3d62e66817a5b57a4e3ee93f64d0d61b4fd63ee7359e" }, "downloads": -1, "filename": "FLaREON-0.0.5.tar.gz", "has_sig": false, "md5_digest": "cacdec600c65650453e3e3a5614ad85c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 16096, "upload_time": "2018-11-09T19:34:14", "url": "https://files.pythonhosted.org/packages/40/c0/6b1fc57ced9f4a2ac8827059747c710feaafbec656e7faa39eac476ef73a/FLaREON-0.0.5.tar.gz" } ], "0.0.6": [ { "comment_text": "", "digests": { "md5": "fb2aa67120b7d03f1deb97147f69c357", "sha256": "0855c4afee384c0bdf845b535e5f21366e2b99cf8f117d8cea8b8ed436ab26ae" }, "downloads": -1, "filename": "FLaREON-0.0.6.tar.gz", "has_sig": false, "md5_digest": "fb2aa67120b7d03f1deb97147f69c357", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 17108, "upload_time": "2018-11-29T14:34:35", "url": "https://files.pythonhosted.org/packages/b2/d6/beb369461956ef5846b796b794922e4ab97aabf24ea705d25c3e32289c7e/FLaREON-0.0.6.tar.gz" } ], "0.0.7": [ { "comment_text": "", "digests": { "md5": "73c8c66eb04349c857c81b3cd93f7ea9", "sha256": "7e88f15b36c9e28ef262e67f8c93ba265d04288afbd989c87f0e157da45bcc60" }, "downloads": -1, "filename": "FLaREON-0.0.7.tar.gz", "has_sig": false, "md5_digest": "73c8c66eb04349c857c81b3cd93f7ea9", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 17125, "upload_time": "2018-11-29T15:41:01", "url": "https://files.pythonhosted.org/packages/5e/7e/540c20f9e3f86945f9d0becc58719d1cd9287864157b217f7f9c3e60026a/FLaREON-0.0.7.tar.gz" } ], "0.0.8": [ { "comment_text": "", "digests": { "md5": "b287d12d713479afa269e6ef24e0e001", "sha256": "30ed0700bffd6949caeed4bbef0712a4e036536a7a4ae793373505a7128a141e" }, "downloads": -1, "filename": "FLaREON-0.0.8.tar.gz", "has_sig": false, "md5_digest": "b287d12d713479afa269e6ef24e0e001", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 17134, "upload_time": "2018-11-29T15:48:31", "url": "https://files.pythonhosted.org/packages/a5/42/8927fbec89749cd1521a50492cae2f7ffc7ce0601579d469ba5f55cb183e/FLaREON-0.0.8.tar.gz" } ], "0.0.9": [ { "comment_text": "", "digests": { "md5": "025ea1c46fe211f1c662ce2320f600e8", "sha256": "81fda90b48ed9a647c38770aae50b184cf3e59cee2439ccaeef91275b1261278" }, "downloads": -1, "filename": "FLaREON-0.0.9.tar.gz", "has_sig": false, "md5_digest": "025ea1c46fe211f1c662ce2320f600e8", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 17138, "upload_time": "2018-11-29T15:50:57", "url": "https://files.pythonhosted.org/packages/bd/a6/90ff3fd8f6d99223683e4cf2ebbc52249475c2c16cb4204834191a7c4611/FLaREON-0.0.9.tar.gz" } ], "1.0.0": [ { "comment_text": "", "digests": { "md5": "221e3c32541f2a1588fd608da74deeb5", "sha256": "ceb0dac6418adb4bced099c2d665b2f5b092b913fcbd35087a63e51281c72699" }, "downloads": -1, "filename": "FLaREON-1.0.0.tar.gz", "has_sig": false, "md5_digest": "221e3c32541f2a1588fd608da74deeb5", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 17156, "upload_time": "2019-09-03T21:49:49", "url": "https://files.pythonhosted.org/packages/e8/b0/7d9d2959803346f0797e3730b9e4b14a026b0c0034fb8e341ddb8fd6a735/FLaREON-1.0.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "221e3c32541f2a1588fd608da74deeb5", "sha256": "ceb0dac6418adb4bced099c2d665b2f5b092b913fcbd35087a63e51281c72699" }, "downloads": -1, "filename": "FLaREON-1.0.0.tar.gz", "has_sig": false, "md5_digest": "221e3c32541f2a1588fd608da74deeb5", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 17156, "upload_time": "2019-09-03T21:49:49", "url": "https://files.pythonhosted.org/packages/e8/b0/7d9d2959803346f0797e3730b9e4b14a026b0c0034fb8e341ddb8fd6a735/FLaREON-1.0.0.tar.gz" } ] }