{"id":21140732,"url":"https://github.com/stanymwamba/traceanalyzer","last_synced_at":"2025-07-27T07:30:36.071Z","repository":{"id":62585069,"uuid":"221711851","full_name":"StanyMwamba/traceanalyzer","owner":"StanyMwamba","description":"This library provides tools for analyzing ns2 trace file using python","archived":false,"fork":false,"pushed_at":"2019-11-18T06:11:28.000Z","size":127,"stargazers_count":3,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-23T19:25:11.933Z","etag":null,"topics":["ns2-trace","ns2-trace-file","packet-delivery-ratio","plot","python","throughput"],"latest_commit_sha":null,"homepage":"https://pypi.org/project/traceanalyzer/","language":null,"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/StanyMwamba.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}},"created_at":"2019-11-14T14:06:23.000Z","updated_at":"2024-07-23T07:54:28.000Z","dependencies_parsed_at":"2022-11-03T22:03:34.762Z","dependency_job_id":null,"html_url":"https://github.com/StanyMwamba/traceanalyzer","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/StanyMwamba/traceanalyzer","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StanyMwamba%2Ftraceanalyzer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StanyMwamba%2Ftraceanalyzer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StanyMwamba%2Ftraceanalyzer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StanyMwamba%2Ftraceanalyzer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/StanyMwamba","download_url":"https://codeload.github.com/StanyMwamba/traceanalyzer/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StanyMwamba%2Ftraceanalyzer/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267324231,"owners_count":24069357,"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-27T02:00:11.917Z","response_time":82,"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":["ns2-trace","ns2-trace-file","packet-delivery-ratio","plot","python","throughput"],"created_at":"2024-11-20T07:17:33.471Z","updated_at":"2025-07-27T07:30:35.821Z","avatar_url":"https://github.com/StanyMwamba.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# traceanalyzer\nThis library  provides analyzing and plotting functions for ns2 trace file in Python. Bellow, example of   ns2 trace file content.\n\n#### Example: content of ns2 trace file\n```\n+ 4.451157 6 10 tcp 1540 ------- 0 32.0 33.0 197 2293\n- 4.451157 6 10 tcp 1540 ------- 0 32.0 33.0 197 2293\nr 4.45128 2 6 tcp 1540 ------- 0 32.0 33.0 198 2294\n+ 4.45128 6 10 tcp 1540 ------- 0 32.0 33.0 198 2294\n- 4.45128 6 10 tcp 1540 ------- 0 32.0 33.0 198 2294\nr 4.451289 20 19 rtProtoDV 34 ------- 0 20.1 19.1 -1 2308\nr 4.451289 20 21 rtProtoDV 34 ------- 0 20.1 21.1 -1 2309\nr 4.451289 20 24 rtProtoDV 34 ------- 0 20.1 24.1 -1 2310\nr 4.451403 2 6 tcp 1540 ------- 0 32.0 33.0 199 2295\n+ 4.451403 6 10 tcp 1540 ------- 0 32.0 33.0 199 2295\n- 4.451403 6 10 tcp 1540 ------- 0 32.0 33.0 199 2295\nr 4.451526 2 6 tcp 1540 ------- 0 32.0 33.0 200 2296\nr 4.531403 23 33 tcp 1540 ------- 0 32.0 33.0 191 2287\n+ 4.531403 33 23 ack 40 ------- 0 33.0 32.0 191 2313\n- 4.531403 33 23 ack 40 ------- 0 33.0 32.0 191 2313\nr 4.531526 23 33 tcp 1540 ------- 0 32.0 33.0 192 2288\n+ 4.531526 33 23 ack 40 ------- 0 33.0 32.0 192 2314\n- 4.531526 33 23 ack 40 ------- 0 33.0 32.0 192 2314\nr 4.53165 23 33 tcp 1540 ------- 0 32.0 33.0 193 2289\n+ 4.53165 33 23 ack 40 ------- 0 33.0 32.0 193 2315\n- 4.53165 33 23 ack 40 ------- 0 33.0 32.0 193 2315\n```\n## Structure\n`traceanalyzer` provide four main classes : `Eedelay`, `Pdr`, `Throughput` and `Nrl`.\u003cbr\u003e\nAccording to [`RFC` (Request for comments)](https://rfc-editor.org) those main classes compute the average of end-to-end delay, the Packet Delivery Ratio, the Throughput and the Normalized Routing Load from `ns2 trace file`. Those provide also plotting and data array extracted from ns2 trace file.\n\n\n### `Eedelay` class\nFor managing (computing, sampling and plotting) the average of end-to-end delay of simulation from trace file.\u003cbr\u003e\n`end-to-end delay=Time/No.Sample`\n#### arguments\n-1st: trace file\u003cbr\u003e\n-2nd: node\n#### outputs\n##### data array\nData without sampling.\u003cbr\u003e\n`eedelay_array` \u003cbr\u003e\n`time_array` \u003cbr\u003e\nData with sampling.\u003cbr\u003e\n`eedelay_sample` \u003cbr\u003e\n`time_sample` \u003cbr\u003e\n##### constant\nvalue      \n### `Pdr` class\nFor managing (computing, sampling and plotting) the Packet Delivery Ratio (`PDR`) of simulation from trace file.\u003cbr\u003e\n`PDR=No.delivered Packet/No.Sent Packet`\n#### arguments\n-1st: trace file\u003cbr\u003e\n-2nd: node\n#### outputs\n##### data array\nData without sampling.\u003cbr\u003e\n`pdr_array` \u003cbr\u003e\n`time_array` \u003cbr\u003e\nData with sampling.\u003cbr\u003e\n`pdr_sample` \u003cbr\u003e\n`time_sample` \u003cbr\u003e\n##### constant\nvalue  \n        \n### `Throughput` class\nFor managing (computing, sampling and plotting) the Throughput average of simulation from trace file.\u003cbr\u003e\n`Average Throughput=Packet received/Time Taken`\n####  arguments\n-1st: trace file\u003cbr\u003e\n-2nd: node\n#### outputs\n##### data array\nData without sampling.\u003cbr\u003e\n`throughput_array` \u003cbr\u003e\n`time_array` \u003cbr\u003e\nData with sampling.\u003cbr\u003e\n`throughput_sample` \u003cbr\u003e\n`time_sample` \u003cbr\u003e\n##### constant\nvalue \n### `Nrl` class\nFor managing (computing, sampling and plotting) the Normalized Routing Load (`NRL`) of simulation from trace file.\u003cbr\u003e\n`NRL=No.Routed packet/No.Delivery packet`\n#### arguments\n-1st: trace file\u003cbr\u003e\n-2nd: routing packet type\n#### outputs\n#####  data array\nData without sampling.\u003cbr\u003e\n`nrl_array` \u003cbr\u003e\n`time_array` \u003cbr\u003e\nData with sampling.\u003cbr\u003e\n`nrl_sample` \u003cbr\u003e\n`time_sample` \u003cbr\u003e\n##### constant\nvalue \n### `Common` methods\n#### sample()\nFor sampling data, by default sampling step is 1 sec.\n#### plot()\nfor plotting data, the arguments are the same than matplotlib.\n## Installation\n\nUse the package manager [pip](https://pip.pypa.io/en/stable/) to install traceanalyzer.\n\n```bash\npip3 install traceanalyzer\n\n```\n\n## Usage\n### Eedelay: End-to-End delay\n#### code\n```python\nimport  traceanalyzer as tr\n#end-to-end delay\needelay1=tr.Eedelay('out1.tr','33')\needelay2=tr.Eedelay('out2.tr','33')\needelay2.sample()#eedelay2.sample(1.5) for sampling with step=1.5\needelay1.plot()\needelay2.plot()\n#getting data\ntime=eedelay2.time_sample\needelay=eedelay2.eedelay_sample\nidx=0\nfor instant in time:\n    print(instant,' ',eedelay[idx]) \n    idx+=1\n```\n#### output\n![alt eedelay](doc/eedelay.png)\n\n```\n0   0\n1.13904   0.56952\n2.13904   0.016842834645669293\n3.13904   0.012456507936507938\n4.14704   0.01097100529100529\n5.14704   0.010232683896620277\n6.14704   0.009788280254777069\n7.14704   0.009491420982735723\n8.14704   0.009279088838268792\n9.14704   0.009119680957128614\n10.14704   0.008995602836879434\n11.14704   0.008896280925778132\n12.14704   0.008814978229317852\n13.14704   0.008747198935462408\n14.14704   0.00868982800982801\n15.14704   0.008640638904734741\n16.14704   0.008597997870074548\n17.14704   0.008560678981527708\n18.14704   0.008527744360902256\n19.14704   0.008498464269862406\n```\n### Pdr: Packet Delivery Ratio\n#### code\n```python\nimport traceanalyzer as tr\n#Packet Delivery Ratio\npdr1=tr.Pdr('out1.tr','33')\npdr1.sample()\npdr1.plot('sr-') #plotting with argument\n#getting data\ntime=pdr1.time_sample\npdr=pdr1.pdr_sample\nidx=0\nfor instant in time:\n    print(instant,' ',pdr[idx]) \n    idx+=1\n```\n#### output\n![alt pdr](doc/pdr.png)\n\n```\n0   0\n1.0   0\n2.0   0.9889106327462491\n3.0   0.9946168461051298\n4.0   0.9964457453481079\n5.0   0.9973470661672909\n6.0   0.9978837296153368\n7.0   0.9982398012010768\n8.0   0.9984933085172383\n9.0   0.998682987294701\n10.0   0.9988302484001926\n11.0   0.9989478895902958\n12.0   0.9990440308159478\n13.0   0.9991240725474031\n14.0   0.999191746303428\n15.0   0.9992497131256068\n16.0   0.9992999217559609\n17.0   0.9993438320209974\n18.0   0.9993825591108851\n19.0   0.9994169696138281\n20.0   0.9994477471331579\n21.235556   1.0\n22.238848   1.0\n23.322692   1.0\n24.352604   1.0\n```\n### Throughput\n#### code\n```python\nimport  traceanalyzer as tr\n#Throughput\nthroughput1=tr.Throughput('out1.tr','33')\nthroughput1.sample()#eedelay2.sample(1.5) for sampling with step=1.5\nthroughput1.plot()\n#getting data\ntime=throughput1.time_sample\nthroughput=throughput1.throughput_sample\nidx=0\nfor instant in time:\n    print(instant,' ',throughput[idx]) \n    idx+=1\n```\n#### output\n![alt throughput](doc/throughput.png)\n\n```\n1.0   0.0\n2.0   436.0\n3.0   624.0\n4.0   718.0\n5.0   774.4\n6.0   812.0\n7.0   838.8571428571429\n8.0   859.0\n9.0   874.6666666666666\n10.0   887.2\n11.0   897.4545454545454\n12.0   906.0\n13.0   913.2307692307693\n14.0   919.4285714285714\n15.0   924.8\n16.0   929.5\n17.0   933.6470588235294\n18.0   937.3333333333334\n19.0   940.6315789473684\n20.0   943.6\n21.235556   895.1025346357779\n22.238848   854.7205322865644\n23.322692   815.0002581177164\n24.352604   780.5325459240416\n```\n### Nrl: Normalized Routing Load\n#### code\n```python\nimport  traceanalyzer as tr\n#Normalized Routing Load\nnrl1=tr.Nrl('out1.tr','rtProtoDV')\nnrl1.sample()\nnrl1.plot()\n#getting data\ntime=nrl1.time_sample\nnrl=nrl1.nrl_sample\nidx=0\nfor instant in time:\n    print(instant,' ',nrl[idx]) \n    idx+=1\n```\n#### output\n![alt nrl](doc/nrl.png)\n\n```\n0   0\n1.0   0\n2.0   1.5052770448548813\n3.0   0.7503979624323464\n4.0   0.49685270667226183\n5.0   0.38319511813487717\n6.0   0.3070109780439122\n7.0   0.2635618711751893\n8.0   0.2274099059115924\n9.0   0.20425102784888682\n10.0   0.1831771837971893\n11.0   0.1688247320488198\n12.0   0.15484633569739953\n13.0   0.14527358052704864\n14.0   0.13513513513513514\n15.0   0.12839538889625016\n16.0   0.12107475480095607\n17.0   0.11583175620872117\n18.0   0.11004506468963512\n19.0   0.10613911670841769\n20.0   0.10147565494376909\n21.235556   0.10311447811447812\n22.238848   0.10495985495985496\n23.322692   0.1060929810929811\n24.352604   0.10816498316498316\n```\n\n## Contributing\nPull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.\n\nPlease make sure to update tests as appropriate.\n\n## License\n[MIT](https://choosealicense.com/licenses/mit/)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstanymwamba%2Ftraceanalyzer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstanymwamba%2Ftraceanalyzer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstanymwamba%2Ftraceanalyzer/lists"}