{"id":22418891,"url":"https://github.com/radi0sus/cal-mb","last_synced_at":"2025-07-16T11:37:13.796Z","repository":{"id":212962537,"uuid":"732710459","full_name":"radi0sus/cal-mb","owner":"radi0sus","description":"Easily calibrate Mößbauer (MB) spectra","archived":false,"fork":false,"pushed_at":"2024-01-05T09:57:19.000Z","size":2771,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-27T04:31:56.786Z","etag":null,"topics":["calibration","fitting","least-squares-optimization","levenberg-marquardt","lmfit","lorentz","mossbauer","mossbauer-spectroscopy","nonlinear-optimization","python","spectroscopy","spectrum"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/radi0sus.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,"governance":null,"roadmap":null,"authors":null}},"created_at":"2023-12-17T15:34:18.000Z","updated_at":"2023-12-18T18:17:07.000Z","dependencies_parsed_at":"2024-01-15T23:25:17.314Z","dependency_job_id":"44e00ceb-43bb-484b-90d7-75768d1b0dfb","html_url":"https://github.com/radi0sus/cal-mb","commit_stats":{"total_commits":37,"total_committers":1,"mean_commits":37.0,"dds":0.0,"last_synced_commit":"e43a4c9394158649d31a4b51a7436018d8943eae"},"previous_names":["radi0sus/cal-mb"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/radi0sus/cal-mb","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/radi0sus%2Fcal-mb","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/radi0sus%2Fcal-mb/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/radi0sus%2Fcal-mb/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/radi0sus%2Fcal-mb/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/radi0sus","download_url":"https://codeload.github.com/radi0sus/cal-mb/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/radi0sus%2Fcal-mb/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265506363,"owners_count":23778718,"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":["calibration","fitting","least-squares-optimization","levenberg-marquardt","lmfit","lorentz","mossbauer","mossbauer-spectroscopy","nonlinear-optimization","python","spectroscopy","spectrum"],"created_at":"2024-12-05T16:13:15.976Z","updated_at":"2025-07-16T11:37:13.634Z","avatar_url":"https://github.com/radi0sus.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Cal-MB\n\nA Python 3 script for easy calibration of ⁵⁷Fe-Mößbauer (MB) spectra from a ⁵⁷Fe sample. \n\n## External modules\n\n`lmfit`\n`numpy` \n`scipy` \n`matplotlib`\n\n## Quick start\n\nStart the script with:\n```console\npython3 cal-mb.py 57Fe_calib_raw_data.ws5\n```\ncalculates the folding point `FP`, `v0` (channel where the velocity is zero),\n`vmax` (maximum velocity), and the velocity / channel `f`.\n\nThe file should contain intensities or counts from a multi-channel analyzer. The popular WissEl \nformat has the extension `.ws5`. In principle any raw data (not only WissEl) can be processed. Pay \nattention to the start channel number and the folding direction.\n\nTerminal output:\n```\n======================================\nResults for 57Fe_calib_raw_data.ws5 :     ⇦ name of the file that contains the ⁵⁷Fe-MB-spectrum \nFile modified on 24.08.2023 13:33:53      ⇦ modification date\n--------------------------------------\nFP (channel) = 256.7889±0.0588            ⇦ folding point\nv₀ (channel) = 125.6873±0.0620            ⇦ channel where velocity is zero\nvmax /mm·s⁻¹ =  -4.6926±0.0111            ⇦ maximum velocity\nf /mm·s⁻¹/c  =   0.0368±0.0001            ⇦ velocity / channel \n======================================\nStatistics (folded data with weights):\n--------------------------------------\ndata points :  256                        ⇦ number of data points\nvariables   :  13                         ⇦ number of variables\nmean σ data :  152.68                     ⇦ weights for χ² and red. χ²\nχ²          :  537.49                     ⇦ Chi square(d) \nred. χ²     :  2.21                       ⇦ reduced Chi square(d)\nR²          :  0.9736                     ⇦ R square(d)\n======================================\n```\nYou can use the first three parameters to fit MB spectra with [fit-mb](https://github.com/radi0sus/fit-mb). \n\nStart the script with:\n```console\npython3 cal-mb.py 57Fe_calib_raw_data.ws5 -s\n```\ncalculates the same values as described above. In addition a `matplotlib` window is shown that \nsummarizes the fit results.\n\n\u003cimg src='examples\\Figure_2.png' alt='Fit' width=600 align='center'\u003e \n\nThe results will not be saved. To keep the output you have to start the script with:\n```console\npython3 cal-mb.py 57Fe_calib_raw_data.ws5 \u003e calib_from_today.txt\n```\nTo keep the figure, you have to click the floppy symbol (similar to 💾) in the `matplotlib` window.\n\n## Remarks\n\n- The script is benchmarked against the `mcal` program from Dr. Eckhard Bill.\n  Within the given restrictions, the results match quite well.\n- Raw spectra (WissEl .ws5 for example) are expected to start at channel 1 and be folded to the right.\n- With the `-fl` option the raw spectrum can be folded to the left.\n- `FP` is the mean of the centers of the individual Lorentz functions (4, 8 or 12) of the raw spectrum.\n- `v0` is the mean of the centers of the individual Lorentz functions (2, 4 or 6) of the folded spectrum.\n- `f` is the mean of `f` calculated with $\\Delta E_Q$ from ⁵⁷Fe divided by the difference of the centers of \n   the single Lorentz functions from the outermost to the innermost pair (see also comment in the script).\n- `vmax` is  `f * 127.5` in case of 256 channels. \n- In case of unfolded data, the error can be estimated from the differences in the intensities of the left-hand side and\n  right-hand side sub-spectra. The weighting for χ² and red. χ² is 1 / (mean standard deviation).\n  The mean standard deviation is the square root of the mean variance of two times the intensities of the left-hand side\n  and right-hand side data pairs which are supposed to be equal. χ² should be close to the number of data points and red. χ²\n  should close to 1 in case of a good fit.    \n  Please note that the calibration parameters are mainly derived from channel or velocity data (x-values), while only errors\n  from intensity data or counts (y-values) are taken into account for the weigths of χ² and red. χ². \n- R² is calculated by 1 - variance(residual * mean standard deviation) / variance(intensities or counts),\n  because R² is calculated wrongly by `lmfit` in case of weights.\n- All other values and errors are calculated with `lmfit`.\n- The script has not been tested with raw data from 1024 channel multi-channel analyzers.\n\n## Example \n\n\u003cimg src='examples\\show-use.gif' alt='Show use' width=600 align='center'\u003e \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fradi0sus%2Fcal-mb","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fradi0sus%2Fcal-mb","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fradi0sus%2Fcal-mb/lists"}