{"id":49535425,"url":"https://github.com/wxzhou/autosave","last_synced_at":"2026-05-02T10:03:29.518Z","repository":{"id":210853542,"uuid":"181639469","full_name":"wxzhou/autosave","owner":"wxzhou","description":"Automatically save running results of your disposable code.","archived":false,"fork":false,"pushed_at":"2019-04-17T09:13:18.000Z","size":13,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2023-12-05T08:35:57.371Z","etag":null,"topics":["science-research","simulation-environment"],"latest_commit_sha":null,"homepage":"","language":"MATLAB","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/wxzhou.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-04-16T07:39:40.000Z","updated_at":"2023-12-05T08:36:04.573Z","dependencies_parsed_at":"2023-12-05T08:46:03.669Z","dependency_job_id":null,"html_url":"https://github.com/wxzhou/autosave","commit_stats":null,"previous_names":["wxzhou/autosave"],"tags_count":0,"template":null,"template_full_name":null,"purl":"pkg:github/wxzhou/autosave","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wxzhou%2Fautosave","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wxzhou%2Fautosave/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wxzhou%2Fautosave/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wxzhou%2Fautosave/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wxzhou","download_url":"https://codeload.github.com/wxzhou/autosave/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wxzhou%2Fautosave/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32530178,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-02T01:12:54.858Z","status":"online","status_checked_at":"2026-05-02T02:00:05.923Z","response_time":132,"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":["science-research","simulation-environment"],"created_at":"2026-05-02T10:03:20.856Z","updated_at":"2026-05-02T10:03:29.506Z","avatar_url":"https://github.com/wxzhou.png","language":"MATLAB","funding_links":[],"categories":[],"sub_categories":[],"readme":"# autosave\nAutomatically save running results of your disposable code.\n\nUnlike software engineers, scientists use computers as their experiment tools and write codes for scientific computation and simulation. A tool that helps them record the computation results is thus necessary:\n\n* The codes are often disposable and no need for branching, rebase, merging or other Git operations. So code management tools such as Git may seem too professional for them.\n* The codes are often saved along with the running results, such as data/variables and figures.\n* The codes are often run for multiple times with changed parameters. It is necessary to record the code/parameter and their corresponding running results.\n\n`autosave` is such a tool.\n\nCurrently supported language: Matlab, Python.\n\n## For Matlab\n\nUse `begin.m` and `over.m`. Typically, `begin.m` and `over.m` are the first and last line of your code, respectively (apart from comments and subfunctions).\n\nA simple example:\n\n```matlab\nbegin on;\nomega = 1;\n\nx = linspace(-pi,pi,100);\ny = sin(omega.*x);\nz = cos(omega.*x);\n\nfigure;\nplot(x,y);\n\nfigure;\nplot(x,z);\n\nover;\n```\n\nSave the code as `Trial.m` and run it, you will find three new files in the same directory of `Trial.m`: `Trial_run1.mat`, `Trial_run1_fig1.fig`, and `Trial_run1_fig2.fig`. Clear your workspace and load `Trial_run1.mat`, you will find not only `omega`, `x`, `y` and `z` in your code, but also a new variable `CODE_CONTENT_IN_THIS_RUN` containing the code, the running time and other information of your computer. `CODE_CONTENT_IN_THIS_RUN` is designed to have such a long and all uppercase name to avoid conflict with your own variable.\n\nIf you change the value of `omega` from 1 to 2 and run the code the second time, you will find another three files: `Trial_run2.mat`, `Trial_run2_fig1.fig`, and `Trial_run2_fig2.fig`. Also, the variable `CODE_CONTENT_IN_THIS_RUN` is in the file `Trial_run2.mat`.\n\nThe code content is saved in `CODE_CONTENT_IN_THIS_RUN` in the command `begin on`. Therefore, you are free to change your code during exeution if it takes a long time.\n\n`over` is default to save all variables in the workspace. Delete the variables before using `over` if you don't want to save them.\n\n## For Python\n\nUse `autosave.py` for Python 2.x and `autosave3.py` for Python 3.x.\n\nThe python part is not as convenient as that of matlab. You have to save the figure by yourself. A simple example:\n\n```python\nimport numpy as np\nimport matplotlib.pyplot as plt\nfrom autosave import saveRunData\n\nomega = 1\nx = np.linspace(-10,10,100)\ny = np.sin(omega*x)\nrun_id = saveRunData({'omega':omega, 'x':x, 'y':y})\n\nplt.figure\nplt.plot(x,y)\nplt.savefig(run_id+'_fig1.png')\n```\n\nSave the code as `Trial.py` and run it, you will find two new files in the same directory of `Trial.py`: `Trial_run1.pkl` and `Trial_run1_fig1.png`. Load data in `Trial_run1.pkl` using the package `cloudpickle` or the function `load` in `autosave.py`, you will find not only the key `omega`, `x` and `y`, but also `CODE_CONTENT_IN_THIS_RUN` containing the code content of your code.\n\nIf you change the value of `omega` from 1 to 2 and run the code the second time, you will find another two files: `Trial_run2.pkl` and `Trial_run2_fig1.png`. Also, the variable `CODE_CONTENT_IN_THIS_RUN` is in the file `Trial_run2.pkl`.\n\nThe code content is saved in `CODE_CONTENT_IN_THIS_RUN` when `saveRunData` is imported. Therefore, you are free to change your code during exeution if it takes a long time.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwxzhou%2Fautosave","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwxzhou%2Fautosave","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwxzhou%2Fautosave/lists"}