{"action":"created","comment":{"url":"https://api.github.com/repos/PlasmaPy/PlasmaPy/pulls/comments/187727486","pull_request_review_id":119573492,"id":187727486,"diff_hunk":"@@ -370,7 +508,129 @@ def Maxwellian_speed_1D(v,\n     >>> from astropy import units as u\n     >>> v=1*u.m/u.s\n     >>> Maxwellian_speed_1D(v=v, T= 30000*u.K, particle='e',V_drift=0*u.m/u.s)\n-    <Quantity 2.60235754e-18 s / m>\n+    <Quantity 1.18326594e-06 s / m>\n+\n+    \"\"\"\n+    if units == \"units\":\n+        # unit checks and conversions\n+        # checking velocity units\n+        v = v.to(u.m / u.s)\n+        # Catching case where drift velocities have default values, they\n+        # need to be assigned units\n+        V_drift = _v_drift_units(V_drift)\n+        # convert temperature to Kelvins\n+        T = T.to(u.K, equivalencies=u.temperature_energy())\n+        if np.isnan(vTh):\n+            # get thermal velocity and thermal velocity squared\n+            vTh = (parameters.thermal_speed(T,\n+                                            particle=particle,\n+                                            method=\"most_probable\"))\n+        elif not np.isnan(vTh):\n+            # check units of thermal velocity\n+            vTh = vTh.to(u.m / u.s)\n+    elif np.isnan(vTh) and units == \"unitless\":\n+        # assuming unitless temperature is in Kelvins\n+        vTh = (parameters.thermal_speed(T * u.K,\n+                                        particle=particle,\n+                                        method=\"most_probable\")).si.value\n+    # Get thermal velocity squared\n+    vThSq = vTh ** 2\n+    # Get square of relative particle velocity\n+    vSq = (v - V_drift) ** 2\n+    # calculating distribution function\n+    coeff = 2 * (vThSq * np.pi) ** (-1 / 2)\n+    expTerm = np.exp(-vSq / vThSq)\n+    distFunc = coeff * expTerm\n+    if units == \"units\":\n+        return distFunc.to(u.s / u.m)\n+    elif units == \"unitless\":\n+        return distFunc\n+\n+\n+def Maxwellian_speed_2D(v,\n+                        T,\n+                        particle=\"e\",\n+                        V_drift=0,\n+                        vTh=np.nan,\n+                        units=\"units\"):\n+    r\"\"\"\n+    pdf of speed for a 2D Maxwellian distribution.\n+\n+    Return the probability of finding a particle with speed components\n+    `vx` and `vy` in m/s in an equilibrium plasma of temperature\n+    `T` which follows the 2D Maxwellian distribution function. This\n+    function assumes Cartesian coordinates.\n+\n+    Parameters\n+    ----------\n+    v: ~astropy.units.Quantity\n+        The speed in units convertible to m/s.\n+\n+    T: ~astropy.units.Quantity\n+        The temperature, preferably in Kelvin.\n+\n+    particle: str, optional\n+        Representation of the particle species(e.g., `'p'` for protons, `'D+'`\n+        for deuterium, or `'He-4 +1'` for :math:`He_4^{+1}`\n+        (singly ionized helium-4)), which defaults to electrons.\n+\n+    V_drift: ~astropy.units.Quantity\n+        The drift speed in units convertible to m/s.\n+\n+    vTh: ~astropy.units.Quantity, optional\n+        Thermal velocity (most probable) in m/s. This is used for\n+        optimization purposes to avoid re-calculating vTh, for example\n+        when integrating over velocity-space.\n+\n+    units: str, optional\n+        Selects whether to run function with units and unit checks (when\n+        equal to \"units\") or to run as unitless (when equal to \"unitless\").\n+        The unitless version is substantially faster for intensive\n+        computations.\n+\n+    Returns\n+    -------\n+    f : ~astropy.units.Quantity\n+        Probability in speed^-1, normalized so that:\n+        :math:`\\iiint_{0}^{\\infty} f(\\vec{v}) d\\vec{v} = 1`.\n+\n+    Raises\n+    ------\n+    TypeError\n+        A parameter argument is not a `~astropy.units.Quantity` and\n+        cannot be converted into a `~astropy.units.Quantity`.\n+\n+    ~astropy.units.UnitConversionError\n+        If the parameters is not in appropriate units.\n+\n+    ValueError\n+        If the temperature is negative, or the particle mass or charge state\n+        cannot be found.\n+\n+    Notes\n+    -----\n+    In 2D, the Maxwellian speed distribution function describing\n+    the distribution of particles with speed :math:`v` in a plasma with\n+    temperature :math:`T` is given by:\n+\n+    .. math::\n+\n+       f = 2 \\pi \\vec{v} (\\pi v_{Th}^2)^{-1} \\exp(-(\\vec{v} -\n+       \\vec{V}_{drift})^2 / v_{Th}^2)","path":"plasmapy/physics/distribution.py","position":508,"original_position":294,"commit_id":"fa5969efeb26ef436764f92319fcdd96fe626731","original_commit_id":"95643bc9841dac7bc68d406393d53994e38dd6f2","user":{"login":"lemmatum","id":28945309,"avatar_url":"https://avatars0.githubusercontent.com/u/28945309?v=4","gravatar_id":"","url":"https://api.github.com/users/lemmatum","html_url":"https://github.com/lemmatum","followers_url":"https://api.github.com/users/lemmatum/followers","following_url":"https://api.github.com/users/lemmatum/following{/other_user}","gists_url":"https://api.github.com/users/lemmatum/gists{/gist_id}","starred_url":"https://api.github.com/users/lemmatum/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lemmatum/subscriptions","organizations_url":"https://api.github.com/users/lemmatum/orgs","repos_url":"https://api.github.com/users/lemmatum/repos","events_url":"https://api.github.com/users/lemmatum/events{/privacy}","received_events_url":"https://api.github.com/users/lemmatum/received_events","type":"User","site_admin":false},"body":"It looks like the 0th modified Bessel function of the first kind has a [nice series expansion](https://reference.wolfram.com/language/ref/BesselI.html), this would then yield a series of integrals which are just different moments of `v`. Then perhaps there is a way to return the function to some sensible form, maybe another Bessel function? Just some ponderings... ","created_at":"2018-05-11T20:41:49Z","updated_at":"2018-05-11T20:41:49Z","html_url":"https://github.com/PlasmaPy/PlasmaPy/pull/452#discussion_r187727486","pull_request_url":"https://api.github.com/repos/PlasmaPy/PlasmaPy/pulls/452","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/PlasmaPy/PlasmaPy/pulls/comments/187727486"},"html":{"href":"https://github.com/PlasmaPy/PlasmaPy/pull/452#discussion_r187727486"},"pull_request":{"href":"https://api.github.com/repos/PlasmaPy/PlasmaPy/pulls/452"}},"in_reply_to_id":187295211},"pull_request":{"url":"https://api.github.com/repos/PlasmaPy/PlasmaPy/pulls/452","id":187060465,"html_url":"https://github.com/PlasmaPy/PlasmaPy/pull/452","diff_url":"https://github.com/PlasmaPy/PlasmaPy/pull/452.diff","patch_url":"https://github.com/PlasmaPy/PlasmaPy/pull/452.patch","issue_url":"https://api.github.com/repos/PlasmaPy/PlasmaPy/issues/452","number":452,"state":"open","locked":false,"title":"Maxwellian 3D speed fixes","user":{"login":"lemmatum","id":28945309,"avatar_url":"https://avatars0.githubusercontent.com/u/28945309?v=4","gravatar_id":"","url":"https://api.github.com/users/lemmatum","html_url":"https://github.com/lemmatum","followers_url":"https://api.github.com/users/lemmatum/followers","following_url":"https://api.github.com/users/lemmatum/following{/other_user}","gists_url":"https://api.github.com/users/lemmatum/gists{/gist_id}","starred_url":"https://api.github.com/users/lemmatum/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lemmatum/subscriptions","organizations_url":"https://api.github.com/users/lemmatum/orgs","repos_url":"https://api.github.com/users/lemmatum/repos","events_url":"https://api.github.com/users/lemmatum/events{/privacy}","received_events_url":"https://api.github.com/users/lemmatum/received_events","type":"User","site_admin":false},"body":"Supersedes #451 \r\nCloses #392 \r\n\r\nOur speed distributions are all wrong. The 1D Maxwellian speed distribution is actually the 3D distribution, so that is being renamed. I'm also adding the correct form for the 1D distribution and adding 2D distributions.","created_at":"2018-05-09T22:50:50Z","updated_at":"2018-05-11T20:41:49Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b661ce5ed9c4d18df306fb8f69d67caa36b95310","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[{"id":607583075,"url":"https://api.github.com/repos/PlasmaPy/PlasmaPy/labels/Status:%20ready%20for%20review","name":"Status: ready for review","color":"0e8a16","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/PlasmaPy/PlasmaPy/pulls/452/commits","review_comments_url":"https://api.github.com/repos/PlasmaPy/PlasmaPy/pulls/452/comments","review_comment_url":"https://api.github.com/repos/PlasmaPy/PlasmaPy/pulls/comments{/number}","comments_url":"https://api.github.com/repos/PlasmaPy/PlasmaPy/issues/452/comments","statuses_url":"https://api.github.com/repos/PlasmaPy/PlasmaPy/statuses/fa5969efeb26ef436764f92319fcdd96fe626731","head":{"label":"lemmatum:Maxwellian3DSpeedFix","ref":"Maxwellian3DSpeedFix","sha":"fa5969efeb26ef436764f92319fcdd96fe626731","user":{"login":"lemmatum","id":28945309,"avatar_url":"https://avatars0.githubusercontent.com/u/28945309?v=4","gravatar_id":"","url":"https://api.github.com/users/lemmatum","html_url":"https://github.com/lemmatum","followers_url":"https://api.github.com/users/lemmatum/followers","following_url":"https://api.github.com/users/lemmatum/following{/other_user}","gists_url":"https://api.github.com/users/lemmatum/gists{/gist_id}","starred_url":"https://api.github.com/users/lemmatum/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lemmatum/subscriptions","organizations_url":"https://api.github.com/users/lemmatum/orgs","repos_url":"https://api.github.com/users/lemmatum/repos","events_url":"https://api.github.com/users/lemmatum/events{/privacy}","received_events_url":"https://api.github.com/users/lemmatum/received_events","type":"User","site_admin":false},"repo":{"id":108632303,"name":"PlasmaPy","full_name":"lemmatum/PlasmaPy","owner":{"login":"lemmatum","id":28945309,"avatar_url":"https://avatars0.githubusercontent.com/u/28945309?v=4","gravatar_id":"","url":"https://api.github.com/users/lemmatum","html_url":"https://github.com/lemmatum","followers_url":"https://api.github.com/users/lemmatum/followers","following_url":"https://api.github.com/users/lemmatum/following{/other_user}","gists_url":"https://api.github.com/users/lemmatum/gists{/gist_id}","starred_url":"https://api.github.com/users/lemmatum/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lemmatum/subscriptions","organizations_url":"https://api.github.com/users/lemmatum/orgs","repos_url":"https://api.github.com/users/lemmatum/repos","events_url":"https://api.github.com/users/lemmatum/events{/privacy}","received_events_url":"https://api.github.com/users/lemmatum/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/lemmatum/PlasmaPy","description":"A community developed python package for plasma physics in the early stages of development.","fork":true,"url":"https://api.github.com/repos/lemmatum/PlasmaPy","forks_url":"https://api.github.com/repos/lemmatum/PlasmaPy/forks","keys_url":"https://api.github.com/repos/lemmatum/PlasmaPy/keys{/key_id}","collaborators_url":"https://api.github.com/repos/lemmatum/PlasmaPy/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/lemmatum/PlasmaPy/teams","hooks_url":"https://api.github.com/repos/lemmatum/PlasmaPy/hooks","issue_events_url":"https://api.github.com/repos/lemmatum/PlasmaPy/issues/events{/number}","events_url":"https://api.github.com/repos/lemmatum/PlasmaPy/events","assignees_url":"https://api.github.com/repos/lemmatum/PlasmaPy/assignees{/user}","branches_url":"https://api.github.com/repos/lemmatum/PlasmaPy/branches{/branch}","tags_url":"https://api.github.com/repos/lemmatum/PlasmaPy/tags","blobs_url":"https://api.github.com/repos/lemmatum/PlasmaPy/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/lemmatum/PlasmaPy/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/lemmatum/PlasmaPy/git/refs{/sha}","trees_url":"https://api.github.com/repos/lemmatum/PlasmaPy/git/trees{/sha}","statuses_url":"https://api.github.com/repos/lemmatum/PlasmaPy/statuses/{sha}","languages_url":"https://api.github.com/repos/lemmatum/PlasmaPy/languages","stargazers_url":"https://api.github.com/repos/lemmatum/PlasmaPy/stargazers","contributors_url":"https://api.github.com/repos/lemmatum/PlasmaPy/contributors","subscribers_url":"https://api.github.com/repos/lemmatum/PlasmaPy/subscribers","subscription_url":"https://api.github.com/repos/lemmatum/PlasmaPy/subscription","commits_url":"https://api.github.com/repos/lemmatum/PlasmaPy/commits{/sha}","git_commits_url":"https://api.github.com/repos/lemmatum/PlasmaPy/git/commits{/sha}","comments_url":"https://api.github.com/repos/lemmatum/PlasmaPy/comments{/number}","issue_comment_url":"https://api.github.com/repos/lemmatum/PlasmaPy/issues/comments{/number}","contents_url":"https://api.github.com/repos/lemmatum/PlasmaPy/contents/{+path}","compare_url":"https://api.github.com/repos/lemmatum/PlasmaPy/compare/{base}...{head}","merges_url":"https://api.github.com/repos/lemmatum/PlasmaPy/merges","archive_url":"https://api.github.com/repos/lemmatum/PlasmaPy/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/lemmatum/PlasmaPy/downloads","issues_url":"https://api.github.com/repos/lemmatum/PlasmaPy/issues{/number}","pulls_url":"https://api.github.com/repos/lemmatum/PlasmaPy/pulls{/number}","milestones_url":"https://api.github.com/repos/lemmatum/PlasmaPy/milestones{/number}","notifications_url":"https://api.github.com/repos/lemmatum/PlasmaPy/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/lemmatum/PlasmaPy/labels{/name}","releases_url":"https://api.github.com/repos/lemmatum/PlasmaPy/releases{/id}","deployments_url":"https://api.github.com/repos/lemmatum/PlasmaPy/deployments","created_at":"2017-10-28T08:23:53Z","updated_at":"2018-04-24T12:33:20Z","pushed_at":"2018-05-11T01:46:28Z","git_url":"git://github.com/lemmatum/PlasmaPy.git","ssh_url":"git@github.com:lemmatum/PlasmaPy.git","clone_url":"https://github.com/lemmatum/PlasmaPy.git","svn_url":"https://github.com/lemmatum/PlasmaPy","homepage":"http://www.plasmapy.org/","size":3372,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"other","name":"Other","spdx_id":null,"url":null},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"PlasmaPy:master","ref":"master","sha":"a452dadd51d612120588c6551dbca7a958b45ea5","user":{"login":"PlasmaPy","id":16004437,"avatar_url":"https://avatars3.githubusercontent.com/u/16004437?v=4","gravatar_id":"","url":"https://api.github.com/users/PlasmaPy","html_url":"https://github.com/PlasmaPy","followers_url":"https://api.github.com/users/PlasmaPy/followers","following_url":"https://api.github.com/users/PlasmaPy/following{/other_user}","gists_url":"https://api.github.com/users/PlasmaPy/gists{/gist_id}","starred_url":"https://api.github.com/users/PlasmaPy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PlasmaPy/subscriptions","organizations_url":"https://api.github.com/users/PlasmaPy/orgs","repos_url":"https://api.github.com/users/PlasmaPy/repos","events_url":"https://api.github.com/users/PlasmaPy/events{/privacy}","received_events_url":"https://api.github.com/users/PlasmaPy/received_events","type":"Organization","site_admin":false},"repo":{"id":46810954,"name":"PlasmaPy","full_name":"PlasmaPy/PlasmaPy","owner":{"login":"PlasmaPy","id":16004437,"avatar_url":"https://avatars3.githubusercontent.com/u/16004437?v=4","gravatar_id":"","url":"https://api.github.com/users/PlasmaPy","html_url":"https://github.com/PlasmaPy","followers_url":"https://api.github.com/users/PlasmaPy/followers","following_url":"https://api.github.com/users/PlasmaPy/following{/other_user}","gists_url":"https://api.github.com/users/PlasmaPy/gists{/gist_id}","starred_url":"https://api.github.com/users/PlasmaPy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PlasmaPy/subscriptions","organizations_url":"https://api.github.com/users/PlasmaPy/orgs","repos_url":"https://api.github.com/users/PlasmaPy/repos","events_url":"https://api.github.com/users/PlasmaPy/events{/privacy}","received_events_url":"https://api.github.com/users/PlasmaPy/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/PlasmaPy/PlasmaPy","description":"A community developed python package for plasma physics in the early stages of development.","fork":false,"url":"https://api.github.com/repos/PlasmaPy/PlasmaPy","forks_url":"https://api.github.com/repos/PlasmaPy/PlasmaPy/forks","keys_url":"https://api.github.com/repos/PlasmaPy/PlasmaPy/keys{/key_id}","collaborators_url":"https://api.github.com/repos/PlasmaPy/PlasmaPy/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/PlasmaPy/PlasmaPy/teams","hooks_url":"https://api.github.com/repos/PlasmaPy/PlasmaPy/hooks","issue_events_url":"https://api.github.com/repos/PlasmaPy/PlasmaPy/issues/events{/number}","events_url":"https://api.github.com/repos/PlasmaPy/PlasmaPy/events","assignees_url":"https://api.github.com/repos/PlasmaPy/PlasmaPy/assignees{/user}","branches_url":"https://api.github.com/repos/PlasmaPy/PlasmaPy/branches{/branch}","tags_url":"https://api.github.com/repos/PlasmaPy/PlasmaPy/tags","blobs_url":"https://api.github.com/repos/PlasmaPy/PlasmaPy/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/PlasmaPy/PlasmaPy/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/PlasmaPy/PlasmaPy/git/refs{/sha}","trees_url":"https://api.github.com/repos/PlasmaPy/PlasmaPy/git/trees{/sha}","statuses_url":"https://api.github.com/repos/PlasmaPy/PlasmaPy/statuses/{sha}","languages_url":"https://api.github.com/repos/PlasmaPy/PlasmaPy/languages","stargazers_url":"https://api.github.com/repos/PlasmaPy/PlasmaPy/stargazers","contributors_url":"https://api.github.com/repos/PlasmaPy/PlasmaPy/contributors","subscribers_url":"https://api.github.com/repos/PlasmaPy/PlasmaPy/subscribers","subscription_url":"https://api.github.com/repos/PlasmaPy/PlasmaPy/subscription","commits_url":"https://api.github.com/repos/PlasmaPy/PlasmaPy/commits{/sha}","git_commits_url":"https://api.github.com/repos/PlasmaPy/PlasmaPy/git/commits{/sha}","comments_url":"https://api.github.com/repos/PlasmaPy/PlasmaPy/comments{/number}","issue_comment_url":"https://api.github.com/repos/PlasmaPy/PlasmaPy/issues/comments{/number}","contents_url":"https://api.github.com/repos/PlasmaPy/PlasmaPy/contents/{+path}","compare_url":"https://api.github.com/repos/PlasmaPy/PlasmaPy/compare/{base}...{head}","merges_url":"https://api.github.com/repos/PlasmaPy/PlasmaPy/merges","archive_url":"https://api.github.com/repos/PlasmaPy/PlasmaPy/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/PlasmaPy/PlasmaPy/downloads","issues_url":"https://api.github.com/repos/PlasmaPy/PlasmaPy/issues{/number}","pulls_url":"https://api.github.com/repos/PlasmaPy/PlasmaPy/pulls{/number}","milestones_url":"https://api.github.com/repos/PlasmaPy/PlasmaPy/milestones{/number}","notifications_url":"https://api.github.com/repos/PlasmaPy/PlasmaPy/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/PlasmaPy/PlasmaPy/labels{/name}","releases_url":"https://api.github.com/repos/PlasmaPy/PlasmaPy/releases{/id}","deployments_url":"https://api.github.com/repos/PlasmaPy/PlasmaPy/deployments","created_at":"2015-11-24T18:36:24Z","updated_at":"2018-05-11T06:00:37Z","pushed_at":"2018-05-11T18:01:36Z","git_url":"git://github.com/PlasmaPy/PlasmaPy.git","ssh_url":"git@github.com:PlasmaPy/PlasmaPy.git","clone_url":"https://github.com/PlasmaPy/PlasmaPy.git","svn_url":"https://github.com/PlasmaPy/PlasmaPy","homepage":"http://www.plasmapy.org/","size":3301,"stargazers_count":160,"watchers_count":160,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":76,"mirror_url":null,"archived":false,"open_issues_count":148,"license":{"key":"other","name":"Other","spdx_id":null,"url":null},"forks":76,"open_issues":148,"watchers":160,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/PlasmaPy/PlasmaPy/pulls/452"},"html":{"href":"https://github.com/PlasmaPy/PlasmaPy/pull/452"},"issue":{"href":"https://api.github.com/repos/PlasmaPy/PlasmaPy/issues/452"},"comments":{"href":"https://api.github.com/repos/PlasmaPy/PlasmaPy/issues/452/comments"},"review_comments":{"href":"https://api.github.com/repos/PlasmaPy/PlasmaPy/pulls/452/comments"},"review_comment":{"href":"https://api.github.com/repos/PlasmaPy/PlasmaPy/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/PlasmaPy/PlasmaPy/pulls/452/commits"},"statuses":{"href":"https://api.github.com/repos/PlasmaPy/PlasmaPy/statuses/fa5969efeb26ef436764f92319fcdd96fe626731"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"lemmatum"}}