{"id":34073417,"url":"https://github.com/baharis/pruby","last_synced_at":"2025-12-30T18:35:50.940Z","repository":{"id":37484681,"uuid":"96685874","full_name":"Baharis/pRuby","owner":"Baharis","description":"Python library for calculating pressure based on ruby fluorescence","archived":false,"fork":false,"pushed_at":"2023-01-16T05:18:00.000Z","size":262,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-27T05:22:52.000Z","etag":null,"topics":["high-pressure","python-library","python36"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Baharis.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-07-09T13:25:33.000Z","updated_at":"2024-10-18T10:30:49.000Z","dependencies_parsed_at":"2023-02-10T01:10:13.398Z","dependency_job_id":null,"html_url":"https://github.com/Baharis/pRuby","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/Baharis/pRuby","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Baharis%2FpRuby","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Baharis%2FpRuby/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Baharis%2FpRuby/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Baharis%2FpRuby/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Baharis","download_url":"https://codeload.github.com/Baharis/pRuby/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Baharis%2FpRuby/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":27723805,"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","status":"online","status_checked_at":"2025-12-14T02:00:11.348Z","response_time":56,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["high-pressure","python-library","python36"],"created_at":"2025-12-14T08:52:58.337Z","updated_at":"2025-12-14T08:52:59.170Z","avatar_url":"https://github.com/Baharis.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# pRuby\r\nPython library for pressure calculation based on ruby fluorescence spectrum.\r\nApart from standard capabilities includes a simple tkinter-based GUI.\r\nAvailable for Python 3.6+ under the MIT License. \r\n\r\n### Dependencies\r\n* [matplotlib](http://www.matplotlib.org/)\r\n* [numpy, scipy](http://www.scipy.org)\r\n* [uncertainties](http://pythonhosted.org/uncertainties/)\r\n* [natsort](https://natsort.readthedocs.io/en/master/)\r\n\r\n### Getting started\r\n\r\nSince pRuby requires specific versions of python and some popular\r\npackages such as `numpy`, it is recommended to use it in a virtual\r\nenvironment in order to avoid version conflicts.\r\nVirtual environment can be usually created using\r\n[`virtualenvwrapper`](http://virtualenvwrapper.readthedocs.io) or\r\n[`virtualenvwrapper-win`](https://github.com/davidmarble/virtualenvwrapper-win)\r\nin the command line:\r\n\r\n    $ mkvirtualenv -p /path/to/python3.6+ pRuby-venv\r\n\r\nAfterwards, the package can bo either installed via PyPI,\r\nwhere it is available under the name `pruby`:\r\n\r\n    $ pip install pruby\r\n\r\n\r\n### Usage\r\n\r\nIn order to evaluate pressure with pRuby, import and work with\r\nthe `PressureCalculator` object. A general routine might include:\r\n    \r\n* Importing the pressure calculator\r\n* Preparing the pressure calculator\r\n* Reading in a ruby fluorescence spectrum\r\n* Calculating pressure based on the R1 position\r\n* Printing the result\r\n* Choosing a place to plot a spectrum\r\n* Plotting the spectrum \r\n\r\nThis routine can be performed in pRuby using the following commands:\r\n\r\n    from pruby import PressureCalculator\r\n    calc = PressureCalculator()\r\n    calc.read('/path/to/ruby/spectrum.txt')\r\n    calc.calculate_p_from_r1\r\n    print(calc.p)\r\n    calc.output_path = '/path/to/plotted/spectrum.png'\r\n    calc.draw()\r\n\r\nOf course, selected steps can be omitted, reorganised, or repeated at will.\r\nInstead of reading an actual spectrum, position of r1 peak can be assigned\r\nmanually by setting the value of `calc.r1`. Pressure can be calculated\r\nbased on r1, but r1 can be calculated based on current pressure as well.\r\nIf `output_path` is not provided, calling `calc.draw()` will show a plot\r\nin a pop-up `matplotlib` window instead. In particular, calling `draw()`\r\nmultiple times will overlay the spectra.\r\n\r\nThe same capabilities can be accessed via simple tkinter GUI,\r\nwhich is functional on all popular systems, although some of its capabilities\r\nwere proved to be limited on Microsoft Windows. In order to run the graphical\r\ninterface, execute the `pRuby_GUI.py` script (if you downloaded it from github)\r\nor start the interface from the level of package using:\r\n\r\n    from pruby import gui\r\n    gui.run()\r\n\r\npRuby GUI provides a simple, minimalistic GUI with the following functionality:\r\n* **Data** - import, draw and handle reference for ruby fluorescence data. \r\n    * **Import** - Import ruby fluorescence data from .txt file, fit the peaks\r\n      according to selected peakhunt method and recalculate R1 and p values.\r\n    * **Draw** - Draw imported data file as well as fitted curve and found peak \r\n      position. Multiple plots will be drawn on the same canvas if it stays open. \r\n    * **To reference** - Export current R1, t and p1 values as a new reference.\r\n    * **From reference** - Import R1, r and p1 data from previously saved reference.\r\n    * **Draw on import** - Toggle this option on in order to automatically draw\r\n      every imported data on the active canvas.\r\n* **Methods** - switch between the strategies to affect the engine\r\nof underlaying calculator and change the behaviour of program.\r\n  * Reading strategies\r\n    * **Raw spectrum txt** - when reading the spectrum, expect a raw txt file\r\n      with two columns containing a sequences of x and y values only.\r\n    * **Metadata spectrum txt** - same as above, but ignore every line which\r\n      can not be interpreted (default).\r\n    * **Single value txt** - expect only a single line with r1 value.\r\n  * Backfitting strategies\r\n    * **Linear Huber** - estimate the background using linear function fitting\r\n      with Huber sigmas (large deviations from the line - peaks - are ignored).\r\n    * **Linear Satelite** - estimate the background using linear function\r\n      fitting with unit sigmas to 1 nm ranges of edge-most data only.\r\n    * **No background fitting** - do not fit any background - assume bg of 0.\r\n  * Peakfitting strategies\r\n    * **Gauss** - find the positions of R1 and R2 using two independent\r\n      Gaussian function centered around each of them and fit to a very small\r\n      amount of data. Very robust approach, but can be inaccurate (default).\r\n    * **Pseudovoigt** - find the position of R1 and R2 using a sum of\r\n      two Gaussian and two Lorentzian functions, centred pairwise on each of\r\n      the peaks. Most precise method for handling sharp, good quality signals.\r\n    * **Camel** - find the positions of R1 and R2 by fitting a sum of three\r\n      Gaussian curves to data: one for R1, one for R1, one low between them.\r\n      Intended fot bad quaility data with heavily overlapping peaks,\r\n      which can not be determined correctly using other approaches.\r\n    * **No peak fitting** - do not fit any curve to model peak in spectrum.\r\n      To be used with **Single value txt** and **No background fitting**. \r\n  * Correcting strategies\r\n    * **Vos R1** - correct for temperature difference accorging to the R1\r\n      equation put forward in 1991 by Vos et al.\r\n      See [doi:10.1063/1.348903](http://aip.scitation.org/doi/10.1063/1.348903)\r\n      (default).\r\n    * **Ragan R1** - correct for temperature difference accorging to equation\r\n      put forward in 1992 by Ragan et al.\r\n      See [doi:10.1063/1.351951](http://aip.scitation.org/doi/10.1063/1.351951).\r\n    * **No t correction** - don't correct for temperature difference.\r\n  * Translating strategies\r\n    * **Jacobsen** - translate R1 position to pressure according to equation\r\n      for helium pressure media put forward in 2008 by Jacobsen et al. \r\n      See [doi:10.2138/am.2008.2988](https://doi.org/10.2138/am.2008.2988).\r\n    * **Liu** - translate R1 position to pressure\r\n      according to equation put forward in 2013 by Liu et al.\r\n      See [doi:10.1088/1674-1056/22/5/056201](http://iopscience.iop.org/article/10.1088/1674-1056/22/5/056201/meta).\r\n    * **Mao** - translate R1 position to pressure\r\n      according to equation put forward in 1986 by Mao et al.\r\n      See [doi:10.1029/JB091iB05p04673](http://onlinelibrary.wiley.com/doi/10.1029/JB091iB05p04673/abstract).\r\n    * **Piermarini** - translate R1 position to pressure\r\n      according to equation put forward in 1975 by Piermarini et al. \r\n      See [doi:10.1063/1.321957](http://aip.scitation.org/doi/10.1063/1.321957).\r\n    * **Ruby2020** - translate R1 position to pressure using equation put\r\n      forward in 2020 by the International Practical Pressure Scale Task Group. \r\n      See [doi:10.1080/08957959.2020.1791107](https://doi.org/10.1080/08957959.2020.1791107)\r\n      (default).\r\n    * **Wei** - translate R1 position to pressure \r\n      according to equation put forward in 2011 by Wei et al.\r\n      See [doi:10.1063/1.3624618](http://aip.scitation.org/doi/10.1063/1.3624618). \r\n  * Drawing strategies\r\n    * **Simple** - draws spectrum with as little details as possible\r\n      to increase clarity, e.g. when overlaying multiple spectra.\r\n    * **Complex** - draw the same elements as **Simple**, but additionally\r\n      plot background profile, fitting range, and determined R2 value as well.\r\n    * **Single line** - minimalistic; draw only a single vertical line at R1.\r\n* **?** - Show basic information about the program\r\n\r\nThese and some other behaviour options are available and can be selected from the package\r\nlevel as well, by modyfying the `engine` attribute of a `PressureCalculator`.\r\nFor example, the temperature correction can be turned off therein using:\r\n\r\n    calc.engine.set_strategy(correcting='None')\r\n\r\nEach of the six strategies (`reading`, `backfitting`, `peakfitting`,\r\n`correcting`, `translating`, and `drawing`) can be changed independently\r\nor together by providing its name, as listed in the table above.\r\n\r\n## Author\r\n\r\nThis software is made by\r\n[Daniel Tchoń](https://www.researchgate.net/profile/Daniel-Tchon),\r\nand distributed under an MIT license. It is in development and all\r\ntips, suggestions, or contributions are welcome and can be sent\r\n[here](mailto:dtchon@lbl.gov).\r\nIf you have utilised pRuby in academic work, please let me know!\r\nIf the tools find a wider use, a dedicated paper will be published.\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbaharis%2Fpruby","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbaharis%2Fpruby","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbaharis%2Fpruby/lists"}