{"id":49547391,"url":"https://github.com/gkoolstra/common","last_synced_at":"2026-05-02T20:04:20.852Z","repository":{"id":208523606,"uuid":"58918199","full_name":"gkoolstra/Common","owner":"gkoolstra","description":"Scientific module to analyze data, including fitting data etc.","archived":false,"fork":false,"pushed_at":"2023-12-06T23:43:50.000Z","size":95,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2023-12-07T19:37:16.225Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gkoolstra.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2016-05-16T08:59:02.000Z","updated_at":"2023-12-07T19:37:16.225Z","dependencies_parsed_at":"2023-11-21T23:40:42.080Z","dependency_job_id":null,"html_url":"https://github.com/gkoolstra/Common","commit_stats":null,"previous_names":["gkoolstra/common"],"tags_count":0,"template":null,"template_full_name":null,"purl":"pkg:github/gkoolstra/Common","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gkoolstra%2FCommon","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gkoolstra%2FCommon/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gkoolstra%2FCommon/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gkoolstra%2FCommon/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gkoolstra","download_url":"https://codeload.github.com/gkoolstra/Common/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gkoolstra%2FCommon/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32547653,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-02T19:18:06.202Z","status":"ssl_error","status_checked_at":"2026-05-02T19:16:21.335Z","response_time":132,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":[],"created_at":"2026-05-02T20:04:14.217Z","updated_at":"2026-05-02T20:04:20.844Z","avatar_url":"https://github.com/gkoolstra.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Common\nCommon is a module used to analyze scientific data, plot it in a clear manner. including fitting data etc. The main contents of this module are: \n\n1. common.py\n2. kfit.py\n\nThese parts should have no dependencies on modules outside of Common, except modules that can be installed using pip. In particular, there should be no dependencies on the slab module. This was the reason that kfit was split off from slab in the first place.\n\n#### Dependencies\nMake sure you have the following packages installed, using `pip install package`, where `package` is one of the following\n\n* tabulate: for printing debugging information and calculation results in table format.\n* mpltools: mainly used in making figures look nice.\n\n## common.py\nThis module contains a lot of commonly used functions for microwave engineering, e.g. converting power in dBm to watts, Vpp and Vrms, calculating the number of photons inside a resonator and more. Moreover, it has some functionality to set up a nice blank canvas for plotting your data, defining a standard marker format for all your plots and quickly creating double axes plots (to name a few). The main point of this module is that it contains a lot of functions that are used in your day-to-day scripts, i.e. they are *common*.\n\n## kfit.py\nThis module was adapted from `slab.dsfit`. It's better documented than `dsfit.py`, and instead of linear least squares, in `kfit.py` we use non-linear least squares fitting from the `scipy.optimize` module. The advantage is that now there's also  a covariance matrix for the output, which we can use to calculate standard deviations on fitted parameters. Currently there are the following functions available, but any additions are welcome:\n\n1. `fit_lor` - Lorentzian\n2. `fit_kinetic_fraction` - Kinetic inductance trace as function of temperature\n3. `fit_double_lor` - Superposition of two Lorentzians\n4. `fit_N_gauss` - Superposition of N Gaussians\n5. `fit_exp` - Exponential decay\n6. `fit_pulse_err` - Pulse error function\n7. `fit_decaysin` - Decaying sine \n8. `fit_sin` - Sine\n9. `fit_gauss` - Gaussian\n10. `fit_hanger` - Hanger function \n11. `fit_parabola` - Parabola\n12. `fit_s11` - Reflection from microwave resonator, 1 or 2 port\n13. `fit_fano` - Transmission through resonator with Fano lineshape\n14. `fit_lor_asym` - Asymmetric Lorentzian transmission peak, due to shunt capacitor.\n15. `fit_poly` - Arbitrary polynomial\n\nAny additions to `kfit.py` should have fit functions of the following form: `fitfunc(x, *p)`, where `x` is the x-data and `p` is a list containing the fit parameters. An example of a fit function is given below: \n\n```python\ndef parabolafunc(x, *p):\n    \"\"\"\n    Parabola function\n    :param x: x-data\n    :param p: [a0, a1, a2] where y = a0 + a1 * (x-a2)**2\n    :return: p[0] + p[1]*(x-p[2])**2\n    \"\"\"\n    return p[0] + p[1]*(x-p[2])**2\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgkoolstra%2Fcommon","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgkoolstra%2Fcommon","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgkoolstra%2Fcommon/lists"}