{"id":16505396,"url":"https://github.com/dlqqq/discharge-normalizer","last_synced_at":"2025-07-23T12:08:51.794Z","repository":{"id":104817102,"uuid":"193613550","full_name":"dlqqq/discharge-normalizer","owner":"dlqqq","description":"CSV parser for selecting and normalizing battery discharge data","archived":false,"fork":false,"pushed_at":"2019-06-28T02:56:40.000Z","size":915,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-03-02T00:46:49.774Z","etag":null,"topics":["battery","csv","lithium-ion","normalization"],"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/dlqqq.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}},"created_at":"2019-06-25T01:50:05.000Z","updated_at":"2023-11-16T09:53:56.000Z","dependencies_parsed_at":"2023-05-30T06:30:45.854Z","dependency_job_id":null,"html_url":"https://github.com/dlqqq/discharge-normalizer","commit_stats":{"total_commits":18,"total_committers":2,"mean_commits":9.0,"dds":0.4444444444444444,"last_synced_commit":"262c95999e9e55fb0856067a7bb45f71b9c26b6b"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/dlqqq/discharge-normalizer","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dlqqq%2Fdischarge-normalizer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dlqqq%2Fdischarge-normalizer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dlqqq%2Fdischarge-normalizer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dlqqq%2Fdischarge-normalizer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dlqqq","download_url":"https://codeload.github.com/dlqqq/discharge-normalizer/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dlqqq%2Fdischarge-normalizer/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266673583,"owners_count":23966376,"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-07-23T02:00:09.312Z","response_time":66,"last_error":null,"robots_txt_status":null,"robots_txt_updated_at":null,"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":["battery","csv","lithium-ion","normalization"],"created_at":"2024-10-11T15:11:07.888Z","updated_at":"2025-07-23T12:08:51.771Z","avatar_url":"https://github.com/dlqqq.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# discharge-normalizer\n\n[screenshot]: ./.github/screenshot.png\n\n![screenshot][screenshot]\n\n`normalizer.py` -- selectively normalizes discharge capacity data\n\n## description\n\n`normalizer.py` is a command line interface (CLI) written in Python 2.7 that\nreads an input directory containing .csv files of battery cycle data. It then\nselects data to process and normalizes the discharge capacities of each selected\ncycle from 0 to 1. This processed data is then output to a nested directory\nwithin the original directory, named `Normalized_Discharge_Capacities`.\n\nData is selected on the following criteria:\n\n* If the percent difference between the global maximum current (over all cycles)\n  and any current measurement within a cycle is greater than 10%, then only the\n  first cycle and all other cycles with \u003e10% current difference are selected. A\n  significant change in current indicates a change within the cycling parameters\n  (e.g.  power consumption), and hence the data should be kept and analyzed\n  during these cycles.\n\n* Otherwise (when no anomalous cycles are detected), then only the first, last, and\n  every 100th trial in between are kept.\n\n## usage\n\n### On UNIX-like distributions:\n\nClone/download this `git` repository and run `./normalizer.py` in your terminal once\ninside the directory.\n\n### On Windows:\n\nClone/download this `git` repository. Open `normalizer.py` by double-clicking on\nthe file, and this should automatically spawn a Windows terminal executing this\nscript in `python2.7`. Alternatively, if Windows does not recognize\n`normalizer.py` or if you just hate the Windows terminal like me, you may\ninstall the `IDLE` Python IDE instead and run this module by pressing `\u003cF5\u003e`.\nThis will allow you to run the script as if you were using a terminal.\n\n## future directions\n\nAs this is my first professional application of Python, I'm quite proud of it.\nHowever, there are many design flaws that can be improved, and I hope to fix\nthem as an exercise to improve my scripting ability in Python.\n\n* __Doesn't take full advantage of Python's features.__ I'm not a big fan of\n  Python thus far.  There are a lot of artificial OOP constructs required by the\n  average programmer to memorize, and are completely embedded within the\n  language. However, in exchange, you get a language that makes programming\n  about as easy as building with Legos, as long as you don't need to care about\n  the speed or bloat of your software. I was completely bored out of my mind\n  studying Python, and I only read the first few chapters on data structures and\n  their objects and methods. I'll try to finish my textbook, and apply some of\n  what I've learned to perhaps shorten this script.\n\n* __Poor input/exception handling.__ I didn't do a lot of testing with this, and\n  there are possibly many hidden nuances of user-side implementation I didn't\n  account for. In addition, as errors in Python throw exceptions that completely\n  shut down the program if not caught in a `try...except` block (rather than\n  having sane exit codes like functions in `C`), tiny mistakes in the input will\n  break the script and bewilder users.  In addition, the input handling could be\n  optimized, I'd like to implement tab-completion and arrow keys if possible.\n\n```\nhydrocodone@t420 ~ % time ./normalizer.py\n...\n./normalizer.py 29.31s user 0.29s system 78% cpu 37.585 total\n```\n\n* __It's slow.__ While Python inherently is a slow, interpreted language, it\n  shouldn't be this slow. There are a lot of reasons for this. This script\n  creates two temporary files and parses each one before generating the next,\n  and thus a total of three files are parsed for every file generated. Not an\n  intelligent or optimized implementation, but it made the most sense and was\n  easy to implement. Ideally, no temporary files should be generated at all.\n  Reducing the number of `for` loops used would also improve performance\n  slightly. For 226MB (only 10 batteries) of data, it takes my Thinkpad T420\n  (Quad-core Intel i5-2520M @3.200GHz) nearly half a minute to process. On the\n  old Windows 7 systems I tested it on, the same 226MB of data took more than a\n  minute. For servers potentially storing gigabytes of unprocessed data, this is\n  unacceptable.\n\n* __It's kind of ugly.__ The lines often exceed 80 characters.  Sometimes, this\n  is because of long strings for the CLI, and must be changed manually until I\n  write a script that helps me format them automatically.  However, most of the\n  time, there are too many indentations, nested `for` loops, etc. The\n  readability should be improved.\n\n## about\n\nThis script was written during my internship at Amprius Corporation, a company\nspecializing in the manufacture of lithium-ion batteries. Hence, it has a rather\nspecific use-case.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdlqqq%2Fdischarge-normalizer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdlqqq%2Fdischarge-normalizer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdlqqq%2Fdischarge-normalizer/lists"}