{"id":20687491,"url":"https://github.com/mrakitin/bnlcrl","last_synced_at":"2026-06-05T10:31:35.135Z","repository":{"id":57415819,"uuid":"63184321","full_name":"mrakitin/bnlcrl","owner":"mrakitin","description":"Simulator of the compound refractive lenses (CRL)","archived":false,"fork":false,"pushed_at":"2020-06-03T13:01:10.000Z","size":7354,"stargazers_count":0,"open_issues_count":4,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-18T21:06:53.367Z","etag":null,"topics":["api","attenuation-length","compound-refractive-lenses","crl","physical-optics","physical-properties","python","refractive-index-decrement","simulator","transmission"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mrakitin.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-07-12T18:50:37.000Z","updated_at":"2020-06-03T13:01:13.000Z","dependencies_parsed_at":"2022-09-01T16:51:38.369Z","dependency_job_id":null,"html_url":"https://github.com/mrakitin/bnlcrl","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrakitin%2Fbnlcrl","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrakitin%2Fbnlcrl/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrakitin%2Fbnlcrl/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrakitin%2Fbnlcrl/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mrakitin","download_url":"https://codeload.github.com/mrakitin/bnlcrl/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242945840,"owners_count":20210762,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","attenuation-length","compound-refractive-lenses","crl","physical-optics","physical-properties","python","refractive-index-decrement","simulator","transmission"],"created_at":"2024-11-16T22:57:30.596Z","updated_at":"2025-03-10T23:58:03.370Z","avatar_url":"https://github.com/mrakitin.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"### bnlcrl\n\nSimulator of the compound refractive lenses (CRL).\n\nLearn more at https://github.com/mrakitin/bnlcrl.\n\nDocumentation: http://bnlcrl.readthedocs.org/en/latest/\n\n| Travis CI | ReadTheDocs | Codecov |\n|:--:|:--:|:--:|\n| [![Build Status](https://travis-ci.org/mrakitin/bnlcrl.svg?branch=master)](https://travis-ci.org/mrakitin/bnlcrl) | [![Documentation Status](https://readthedocs.org/projects/bnlcrl/badge/?version=latest)](http://bnlcrl.readthedocs.io/en/latest/?badge=latest) | [![codecov](https://codecov.io/gh/mrakitin/bnlcrl/branch/master/graph/badge.svg)](https://codecov.io/gh/mrakitin/bnlcrl) |\n\n----\nThe code is written in Python, tested to be working under Linux and Windows with Python 2.7/3.5. There is no required NumPy dependency, but it still can be used for operations with matrices, etc. (see the `Usage` section below).\n\nDetermine Delta/Attenuation length:\n-\nTo create a `.dat` file with the refractive index decrement or the attenuation length, use the following commands respectively:\n```bash\nbnlcrl simulate find-delta --characteristic delta -f Al -o Al_delta.dat 30\n```\n\n```bash\nbnlcrl simulate find-delta --characteristic atten -f Al -o Al_atten.dat 30\n```\n\nUsage:\n-\n```\n$ bnlcrl simulate find-delta -h\nusage: bnlcrl simulate find-delta [-h] [--calc-delta]\n                                  [--characteristic {transmission,atten,delta}]\n                                  [-d DATA_FILE] [--e-max E_MAX]\n                                  [--e-min E_MIN] [--e-step E_STEP]\n                                  [-f FORMULA] [-n N_POINTS] [-o OUTFILE]\n                                  [--plot] [--precise] [--save]\n                                  [--save-output] [--show-plot] [-t THICKNESS]\n                                  [-u] [-v]\n                                  energy\n\nDetermine the Index of Refraction (delta).\n\n        The index of refraction can be defined by three different methods/approaches:\n\n        1) Get delta for the closest energy from the saved *.dat files (see ``bnlcrl/package_data/dat/``).\n\n        2) Get delta from http://henke.lbl.gov/optical_constants/getdb2.html.\n\n        3) Calculate delta analytically (requires ``periodictable`` package installed).\n\n    Args:\n        calc_delta (bool): a flag to calculate delta analytically.\n        characteristic (str): characteristic to be extracted (``atten`` - attenuation length, ``delta`` - index of refraction, ``transmission`` - filter transmission).\n        data_file (str): a *.dat data file in ``bnlcrl/package_data/dat/`` directory with delta values for the material of the CRL (e.g., Be).\n        e_max (float): the highest available energy [eV].\n        e_min (float): the lowest available energy [eV].\n        e_step (float): energy step size used for saving data to a file [eV].\n        energy (float): photon energy [eV].\n        formula (str): material's formula of the interest.\n        n_points (int): number of points to get from the server.\n        outfile (str): optional output file.\n        plot (bool): a flag to plot the obtained data.\n        precise (bool): a flag to find delta within the energy interval +/- 1 eV from the specified energy.\n        save (bool): a flag to save the obtained data.\n        save_output (bool): a flag to save the output dictionary in JSON format.\n        show_plot (bool): a flag to show the show the plot.\n        thickness (float): thickness of the material.\n        use_numpy (bool): a flag to use NumPy.\n        verbose (bool): a flag to print output to console.\n\n    Returns:\n        dict: dictionary with the result.\n\n\npositional arguments:\n  energy                -\n\noptional arguments:\n  -h, --help            show this help message and exit\n  --calc-delta          False\n  --characteristic {transmission,atten,delta}\n                        'delta'\n  -d DATA_FILE, --data-file DATA_FILE\n                        ''\n  --e-max E_MAX         30000.0\n  --e-min E_MIN         30.0\n  --e-step E_STEP       10.0\n  -f FORMULA, --formula FORMULA\n                        'Be'\n  -n N_POINTS, --n-points N_POINTS\n                        500\n  -o OUTFILE, --outfile OUTFILE\n                        ''\n  --plot                False\n  --precise             False\n  --save                False\n  --save-output         False\n  --show-plot           False\n  -t THICKNESS, --thickness THICKNESS\n                        0.1\n  -u, --use-numpy       False\n  -v, --verbose         False\n```\n\nExamples of execution:\n-\n```bash\n$ bnlcrl simulate simulate-crl -p 6.52 -v --output-format json 2 4 6 7 8 21500\n{\n    \"d\": 0.0012016728926447229,\n    \"d_ideal\": -0.06613035908221399,\n    \"f\": 1.0480597834969956,\n    \"p0\": 6.52,\n    \"p1\": 1.2487983271073553,\n    \"p1_ideal\": 1.3161303590822135\n}\n```\n\n```bash\n$ bnlcrl simulate simulate-crl -p 6.52 -v --output-format csv 2 4 6 7 8 21500\n\"d\",\"d_ideal\",\"f\",\"p0\",\"p1\",\"p1_ideal\"\n0.00120167289264,-0.0661303590822,1.0480597835,6.52,1.24879832711,1.31613035908\n```\n\n```bash\n$ bnlcrl simulate simulate-crl -p 6.52 -v --output-format txt 2 4 6 7 8 21500\nd: 0.00120167289264, d_ideal: -0.0661303590822, f: 1.0480597835, p0: 6.52, p1: 1.24879832711, p1_ideal: 1.31613035908\n```\n\n```\n$ bnlcrl simulate simulate-crl -p 6.52 21500 -v\n\"d\",\"d_ideal\",\"f\",\"p0\",\"p1\",\"p1_ideal\"\n0,0,0,6.52,0,0\n```\n\nThis library is used on the SMI beamline at NSLS-II:\n![transfocator](docs/transfocator.png)\n\n![attenuation filters](docs/attenuation_filters.png)\n\n#### License\n\nLicense: http://www.apache.org/licenses/LICENSE-2.0.html\n\nCopyright (c) 2016 mrakitin (BNL).  All Rights Reserved.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmrakitin%2Fbnlcrl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmrakitin%2Fbnlcrl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmrakitin%2Fbnlcrl/lists"}