Title: Defining a DType struct in C# for use in np.fromfile · Issue #131 · SciSharp/Numpy.NET · GitHub
Open Graph Title: Defining a DType struct in C# for use in np.fromfile · Issue #131 · SciSharp/Numpy.NET
X Title: Defining a DType struct in C# for use in np.fromfile · Issue #131 · SciSharp/Numpy.NET
Description: How would I transpose the below code chunk to C#? I'm trying to convert the following python code to be used in C#. The point of this function is to parse a binary file's data into a collection of defined objects. dtype = np.dtype([ ("re...
Open Graph Description: How would I transpose the below code chunk to C#? I'm trying to convert the following python code to be used in C#. The point of this function is to parse a binary file's data into a collection of ...
X Description: How would I transpose the below code chunk to C#? I'm trying to convert the following python code to be used in C#. The point of this function is to parse a binary file's data into a collec...
Opengraph URL: https://github.com/SciSharp/Numpy.NET/issues/131
X: @github
Domain: patch-diff.githubusercontent.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Defining a DType struct in C# for use in np.fromfile","articleBody":"How would I transpose the below code chunk to C#? I'm trying to convert the following python code to be used in C#. The point of this function is to parse a binary file's data into a collection of defined objects.\r\n\r\n\r\n```\r\ndtype = np.dtype([\r\n\t(\"reading_1\", np.float64),\r\n\t(\"reading_2\", np.float32),\r\n\t(\"reading_3\", np.float64)\r\n# and so on\r\n])\r\n...\r\n# file is a binary file of the structured data defined above\r\ndatachunks = np.fromfile(file, dtype)\r\n# do things with arrays of reading_1, reading_2, reading_3 from datachunks\r\n```\r\n\r\nMy roadblock right now is that I do not know how to write the 'dtype' segment in C#. I have tried to declare a struct of my own and using it as a parameter for np.fromfile, which I know will not work because np.fromfile requires a Dtype.\r\n\r\n```\r\n[StructLayout(LayoutKind.Sequential)]\r\npublic struct ReadingData\r\n{\r\n public double reading_1;\r\n public float reading_2;\r\n public double reading_1;\r\n}\r\n...\r\nNDArray datachunks = np.fromfile(filename, ReadingData);\r\n// syntax error as ReadingData is not a dtype\r\n```\r\n\r\nI can't find any examples on writing a dtype struct in SciSharp's C# Numpy, so I am stumped.","author":{"url":"https://github.com/yolothedino","@type":"Person","name":"yolothedino"},"datePublished":"2024-12-10T09:00:32.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":1},"url":"https://github.com/131/Numpy.NET/issues/131"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:a8362620-91a9-6a29-a3bb-1a84572997cd |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | DF08:98268:6D3E36:953E86:696F257C |
| html-safe-nonce | a37e3ed72844359bda71575dbfa2783a77b67c0e9906d3cac703a7196d9686ea |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJERjA4Ojk4MjY4OjZEM0UzNjo5NTNFODY6Njk2RjI1N0MiLCJ2aXNpdG9yX2lkIjoiMTExOTQ1NjIyOTMwNjg2OTExNiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 43fc4a52beb44e277c212939f32ec7439cca9f83184cff8ba9144869545dcde2 |
| hovercard-subject-tag | issue:2729456862 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/SciSharp/Numpy.NET/131/issue_layout |
| twitter:image | https://opengraph.githubassets.com/6bf46cac8b6ee74657cc2d3833e43ef3c344832c69151f3f62ce51fc112a415f/SciSharp/Numpy.NET/issues/131 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/6bf46cac8b6ee74657cc2d3833e43ef3c344832c69151f3f62ce51fc112a415f/SciSharp/Numpy.NET/issues/131 |
| og:image:alt | How would I transpose the below code chunk to C#? I'm trying to convert the following python code to be used in C#. The point of this function is to parse a binary file's data into a collection of ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | yolothedino |
| hostname | github.com |
| expected-hostname | github.com |
| None | b278ad162d35332b6de714dfb005de04386c4d92df6475522bef910f491a35ee |
| turbo-cache-control | no-preview |
| go-import | github.com/SciSharp/Numpy.NET git https://github.com/SciSharp/Numpy.NET.git |
| octolytics-dimension-user_id | 44989469 |
| octolytics-dimension-user_login | SciSharp |
| octolytics-dimension-repository_id | 189782132 |
| octolytics-dimension-repository_nwo | SciSharp/Numpy.NET |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 189782132 |
| octolytics-dimension-repository_network_root_nwo | SciSharp/Numpy.NET |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 39aed5006635ab6f45e6b77d23e73b08a00272a3 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width