{"id":24740034,"url":"https://github.com/garrettj403/czt","last_synced_at":"2025-04-06T12:08:01.106Z","repository":{"id":46580481,"uuid":"315978179","full_name":"garrettj403/CZT","owner":"garrettj403","description":"Chirp Z-Transform","archived":false,"fork":false,"pushed_at":"2024-12-20T07:34:08.000Z","size":12843,"stargazers_count":44,"open_issues_count":0,"forks_count":16,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-03-30T11:06:37.980Z","etag":null,"topics":["czt","dft","dsp","fourier-transform","frequency-domain","signal-processing","z-transform"],"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/garrettj403.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGES.md","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,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-11-25T15:22:31.000Z","updated_at":"2025-03-11T11:36:36.000Z","dependencies_parsed_at":"2025-02-27T16:33:16.366Z","dependency_job_id":"283b9ea9-5a31-49c2-ba9b-84bc348098fc","html_url":"https://github.com/garrettj403/CZT","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/garrettj403%2FCZT","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/garrettj403%2FCZT/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/garrettj403%2FCZT/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/garrettj403%2FCZT/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/garrettj403","download_url":"https://codeload.github.com/garrettj403/CZT/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247478321,"owners_count":20945266,"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":["czt","dft","dsp","fourier-transform","frequency-domain","signal-processing","z-transform"],"created_at":"2025-01-27T23:14:22.236Z","updated_at":"2025-04-06T12:08:01.091Z","avatar_url":"https://github.com/garrettj403.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"Chirp Z-Transform (CZT)\r\n=======================\r\n\r\n[![PyPI version](https://badge.fury.io/py/czt.svg)](https://badge.fury.io/py/czt)\r\n[![ci](https://github.com/garrettj403/CZT/actions/workflows/ci.yml/badge.svg)](https://github.com/garrettj403/CZT/actions/workflows/ci.yml)\r\n[![flake8](https://github.com/garrettj403/CZT/actions/workflows/linter.yml/badge.svg)](https://github.com/garrettj403/CZT/actions/workflows/linter.yml)\r\n\r\nFrom [Wikipedia](https://en.wikipedia.org/wiki/Chirp_Z-transform):\r\n\r\n\u003e The chirp Z-transform (CZT) is a generalization of the discrete Fourier transform (DFT). While the DFT samples the Z plane at uniformly-spaced points along the unit circle, the chirp Z-transform samples along spiral arcs in the Z-plane, corresponding to straight lines in the S plane. The DFT, real DFT, and zoom DFT can be calculated as special cases of the CZT.\r\n\r\nGetting Started\r\n---------------\r\n\r\nYou can install the CZT package using ``pip``:\r\n\r\n   ```bash\r\n   # to install the latest release (from PyPI)\r\n   pip install czt\r\n\r\n   # to install the latest commit (from GitHub)\r\n   git clone https://github.com/garrettj403/CZT.git\r\n   cd CZT\r\n   pip install -e .\r\n\r\n   # to install dependencies for examples\r\n   pip install -e .[examples]\r\n   \r\n   # to install dependencies for testing\r\n   pip install -e .[testing]\r\n   ```\r\n\r\nExample\r\n-------\r\n\r\nConsider the following time-domain signal:\r\n\r\n\u003cp align=\"center\"\u003e\r\n\u003cimg src=\"https://raw.githubusercontent.com/garrettj403/CZT/main/examples/results/signal.png\" width=\"500\"\u003e\r\n\u003c/p\u003e\r\n\r\nThis is an exponentially decaying sine wave with some distortion from higher-order frequencies. We can convert this signal to the frequency-domain to investigate the frequency content using the Chirp Z-Transform (CZT):\r\n\r\n\u003cp align=\"center\"\u003e\r\n\u003cimg src=\"https://raw.githubusercontent.com/garrettj403/CZT/main/examples/results/freq-domain.png\" width=\"500\"\u003e\r\n\u003c/p\u003e\r\n\r\nNote that the CZT also allows us to calculate the frequency response over an arbitrary frequency range:\r\n\r\n\u003cp align=\"center\"\u003e\r\n\u003cimg src=\"https://raw.githubusercontent.com/garrettj403/CZT/main/examples/results/zoom-czt.png\" width=\"500\"\u003e\r\n\u003c/p\u003e\r\n\r\nWe can see that the signal has frequency components at 1 kHz, 2.5 kHz and 3.5 kHz. To remove the distortion and isolate the 1 kHz signal, we can apply a simple window in the frequency-domain:\r\n\r\n\u003cp align=\"center\"\u003e\r\n\u003cimg src=\"https://raw.githubusercontent.com/garrettj403/CZT/main/examples/results/windowed-freq-domain.png\" width=\"500\"\u003e\r\n\u003c/p\u003e\r\n\r\nFinally, we can use the Inverse Chirp Z-Transform (ICZT) to transform back to the time domain:\r\n\r\n\u003cp align=\"center\"\u003e\r\n\u003cimg src=\"https://raw.githubusercontent.com/garrettj403/CZT/main/examples/results/windowed-time-domain.png\" width=\"500\"\u003e\r\n\u003c/p\u003e\r\n\r\nAs we can see, we were able to remove the higher-order frequencies that were distorting our 1 kHz signal.\r\n\r\nYou can find this example and others in the [``examples/``](https://github.com/garrettj403/CZT/blob/main/examples/)  directory.\r\n\r\nReferences\r\n----------\r\n\r\n- [L. Rabiner, R. Schafer and C. Rader, \"The chirp z-transform algorithm,\" *IEEE Transactions on Audio and Electroacoustics*, vol. 17, no. 2, pp. 86-92, Jun. 1969, doi: 10.1109/TAU.1969.1162034.](https://web.ece.ucsb.edu/Faculty/Rabiner/ece259/Reprints/015_czt.pdf)\r\n\r\n- [V. Sukhoy and A. Stoytchev, \"Generalizing the inverse FFT off the unit circle,\" *Scientific Reports*, vol. 9, no. 14443, Oct. 2019, doi: 10.1038/s41598-019-50234-9.](https://doi.org/10.1038/s41598-019-50234-9)\r\n\r\n- [Chirp Z-Transform (Wikipedia)](https://en.wikipedia.org/wiki/Chirp_Z-transform)\r\n\r\n- [Discrete Fourier Transform (Wikipedia)](https://en.wikipedia.org/wiki/Discrete_Fourier_transform)\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgarrettj403%2Fczt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgarrettj403%2Fczt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgarrettj403%2Fczt/lists"}