{"action":"created","comment":{"url":"https://api.github.com/repos/Caltech-IPAC/firefly/pulls/comments/64263669","id":64263669,"diff_hunk":"@@ -1107,25 +1144,129 @@ private static double getPowerLawGammaStretchedPixelValue(double x, double gamma\n         return pixValue;\n \n     }\n+\n+    /**\n+     * The asinh stretch algorithm is defined in the paper by Robert Lupton et al at \"The Astronomical Journal 118: 1406-1410, 1999 Sept\"\n+     * In the paper:\n+     *    magnitude = m_0-2.5log(b) - a* asinh (x/2b)  = mu_0  -a * asinh (x/2b), where mu_0 =m_0 - 2.5 * ln(b), a =2.5ln(e) = 1.08574,\n+     *    m_o=2.5log(flux_0), flux_0 is the flux of an object with magnitude 0.0.\n+     *    b is an arbitrary \"softening\" which determines the flux level as which the liner behavior is set in, and x is the flux,\n+     *\n+     *\n+     *   Since  mu_0 and a are constant, we can use just:\n+     *     mu =  asinh( flux/(2.0*b)) ) = asin(x/beta); where beta=2*b;\n+     * @param beta\n+     * @return\n+     */\n+    private double  getASinhStretchedPixelValue(double flux, double maxFlux, double minFlux, double beta)  {\n+\n+        /*\n+         Since the data range is from minFlux to maxFlux, we can shift the data to  the range [0 - (maxFlux-minFlux)].\n+         Thus,\n+                   flux_new = flux-minFlux,\n+                   minFlux_new = 0\n+                   maxFlux_new = maxFlux - minFlux\n+         min = asinh( abs(minFlux_new) -square(minFlux_new*minFlux_new+1) ) =0\n+         max = (max-min) = asinh( maxFlux_new/beta) = asinh( (maxFlux-minFlux)/beta)\n+         diff = max - min = max\n+         */\n+        double asinhMagnitude =  asinh( (flux-minFlux) / beta); //beta = 2*b\n+\n+        //normalize to 0 - 255:  (nCorlor-1 )*(x - Min)/(Max - Min), 8 bit nCorlor=256\n+        //this formula is referred from IDL function: BYTSCL\n+        double diff =   asinh ( (maxFlux-minFlux)/beta );\n+        return  255* asinhMagnitude/ diff ;\n+\n+    }\n+\n+\n     private static double asinh(double x) {\n \n-        return Math.log(x + Math.sqrt(x * x + 1));\n+        double y  = Math.log( Math.abs(x ) + Math.sqrt(x * x + 1));\n+        y = x<0? -y:y;\n+\n+        return y;\n \n     }\n-    private static double getASinhStretchedPixelValue(double x, double dr, double zp, double mp, double bp, double wp)  {\n \n+    /**\n+     * Calculate the mean flux value\n+     * @param data\n+     * @return\n+     */\n+     private  double getMean(double [] data ) {\n \n+           int size = data.length;\n+           float sum = 0.0f;\n+            for(double a : data)\n+                sum += a;\n+            return sum/size;\n+     }\n \n-        double rd = dr * (x - zp) / mp; //in the range of 0 - dr (when zp=0.0)\n-        double nsd = asinh(rd) / asinh(mp - zp); // in the range 0-1 when zp=0.0\n-        double pixValue = 255 * (nsd - bp) / wp;\n+    /**\n+     * Calculate variance and then standard deviation\n+     * @param data\n+     * @return\n+     */\n+      private double getStdDev(double[] data) {","path":"src/firefly/java/edu/caltech/ipac/visualize/plot/FitsRead.java","position":289,"original_position":289,"commit_id":"611fc933864b73241a82592872348d0c1ea7214e","original_commit_id":"611fc933864b73241a82592872348d0c1ea7214e","user":{"login":"robyww","id":6730519,"avatar_url":"https://avatars.githubusercontent.com/u/6730519?v=3","gravatar_id":"","url":"https://api.github.com/users/robyww","html_url":"https://github.com/robyww","followers_url":"https://api.github.com/users/robyww/followers","following_url":"https://api.github.com/users/robyww/following{/other_user}","gists_url":"https://api.github.com/users/robyww/gists{/gist_id}","starred_url":"https://api.github.com/users/robyww/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/robyww/subscriptions","organizations_url":"https://api.github.com/users/robyww/orgs","repos_url":"https://api.github.com/users/robyww/repos","events_url":"https://api.github.com/users/robyww/events{/privacy}","received_events_url":"https://api.github.com/users/robyww/received_events","type":"User","site_admin":false},"body":"same here, static?","created_at":"2016-05-23T18:22:28Z","updated_at":"2016-05-23T18:22:28Z","html_url":"https://github.com/Caltech-IPAC/firefly/pull/87#discussion_r64263669","pull_request_url":"https://api.github.com/repos/Caltech-IPAC/firefly/pulls/87","_links":{"self":{"href":"https://api.github.com/repos/Caltech-IPAC/firefly/pulls/comments/64263669"},"html":{"href":"https://github.com/Caltech-IPAC/firefly/pull/87#discussion_r64263669"},"pull_request":{"href":"https://api.github.com/repos/Caltech-IPAC/firefly/pulls/87"}}},"pull_request":{"url":"https://api.github.com/repos/Caltech-IPAC/firefly/pulls/87","id":70601214,"html_url":"https://github.com/Caltech-IPAC/firefly/pull/87","diff_url":"https://github.com/Caltech-IPAC/firefly/pull/87.diff","patch_url":"https://github.com/Caltech-IPAC/firefly/pull/87.patch","issue_url":"https://api.github.com/repos/Caltech-IPAC/firefly/issues/87","number":87,"state":"open","locked":false,"title":"DM-5799: changed both the server side and client side to implement th…","user":{"login":"lznakano","id":11981693,"avatar_url":"https://avatars.githubusercontent.com/u/11981693?v=3","gravatar_id":"","url":"https://api.github.com/users/lznakano","html_url":"https://github.com/lznakano","followers_url":"https://api.github.com/users/lznakano/followers","following_url":"https://api.github.com/users/lznakano/following{/other_user}","gists_url":"https://api.github.com/users/lznakano/gists{/gist_id}","starred_url":"https://api.github.com/users/lznakano/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lznakano/subscriptions","organizations_url":"https://api.github.com/users/lznakano/orgs","repos_url":"https://api.github.com/users/lznakano/repos","events_url":"https://api.github.com/users/lznakano/events{/privacy}","received_events_url":"https://api.github.com/users/lznakano/received_events","type":"User","site_admin":false},"body":"The correct asinh algorithm is used in this implementation.  Please view this branch and let me know if any changes are needed. \r\n\r\nPlease check \r\n1.  whether displaying dataMin/dataMax and beta looks OK\r\n2.  I don't think that we need dataMin and dataMax in the list . Data alone is enough.  When users choose   data, the dataMin is the default for the lower range and the dataMax is the default for the upper range.  dataMin and dataMax really do nothing. \r\n\r\nThanks!","created_at":"2016-05-18T21:19:41Z","updated_at":"2016-05-23T18:22:28Z","closed_at":null,"merged_at":null,"merge_commit_sha":"2fdd226b84992e3171da45b83ab9466067ddd7ca","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/Caltech-IPAC/firefly/pulls/87/commits","review_comments_url":"https://api.github.com/repos/Caltech-IPAC/firefly/pulls/87/comments","review_comment_url":"https://api.github.com/repos/Caltech-IPAC/firefly/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Caltech-IPAC/firefly/issues/87/comments","statuses_url":"https://api.github.com/repos/Caltech-IPAC/firefly/statuses/611fc933864b73241a82592872348d0c1ea7214e","head":{"label":"Caltech-IPAC:DM-5799-Asinh","ref":"DM-5799-Asinh","sha":"611fc933864b73241a82592872348d0c1ea7214e","user":{"login":"Caltech-IPAC","id":9708378,"avatar_url":"https://avatars.githubusercontent.com/u/9708378?v=3","gravatar_id":"","url":"https://api.github.com/users/Caltech-IPAC","html_url":"https://github.com/Caltech-IPAC","followers_url":"https://api.github.com/users/Caltech-IPAC/followers","following_url":"https://api.github.com/users/Caltech-IPAC/following{/other_user}","gists_url":"https://api.github.com/users/Caltech-IPAC/gists{/gist_id}","starred_url":"https://api.github.com/users/Caltech-IPAC/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Caltech-IPAC/subscriptions","organizations_url":"https://api.github.com/users/Caltech-IPAC/orgs","repos_url":"https://api.github.com/users/Caltech-IPAC/repos","events_url":"https://api.github.com/users/Caltech-IPAC/events{/privacy}","received_events_url":"https://api.github.com/users/Caltech-IPAC/received_events","type":"Organization","site_admin":false},"repo":{"id":33508214,"name":"firefly","full_name":"Caltech-IPAC/firefly","owner":{"login":"Caltech-IPAC","id":9708378,"avatar_url":"https://avatars.githubusercontent.com/u/9708378?v=3","gravatar_id":"","url":"https://api.github.com/users/Caltech-IPAC","html_url":"https://github.com/Caltech-IPAC","followers_url":"https://api.github.com/users/Caltech-IPAC/followers","following_url":"https://api.github.com/users/Caltech-IPAC/following{/other_user}","gists_url":"https://api.github.com/users/Caltech-IPAC/gists{/gist_id}","starred_url":"https://api.github.com/users/Caltech-IPAC/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Caltech-IPAC/subscriptions","organizations_url":"https://api.github.com/users/Caltech-IPAC/orgs","repos_url":"https://api.github.com/users/Caltech-IPAC/repos","events_url":"https://api.github.com/users/Caltech-IPAC/events{/privacy}","received_events_url":"https://api.github.com/users/Caltech-IPAC/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Caltech-IPAC/firefly","description":"","fork":false,"url":"https://api.github.com/repos/Caltech-IPAC/firefly","forks_url":"https://api.github.com/repos/Caltech-IPAC/firefly/forks","keys_url":"https://api.github.com/repos/Caltech-IPAC/firefly/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Caltech-IPAC/firefly/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Caltech-IPAC/firefly/teams","hooks_url":"https://api.github.com/repos/Caltech-IPAC/firefly/hooks","issue_events_url":"https://api.github.com/repos/Caltech-IPAC/firefly/issues/events{/number}","events_url":"https://api.github.com/repos/Caltech-IPAC/firefly/events","assignees_url":"https://api.github.com/repos/Caltech-IPAC/firefly/assignees{/user}","branches_url":"https://api.github.com/repos/Caltech-IPAC/firefly/branches{/branch}","tags_url":"https://api.github.com/repos/Caltech-IPAC/firefly/tags","blobs_url":"https://api.github.com/repos/Caltech-IPAC/firefly/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Caltech-IPAC/firefly/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Caltech-IPAC/firefly/git/refs{/sha}","trees_url":"https://api.github.com/repos/Caltech-IPAC/firefly/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Caltech-IPAC/firefly/statuses/{sha}","languages_url":"https://api.github.com/repos/Caltech-IPAC/firefly/languages","stargazers_url":"https://api.github.com/repos/Caltech-IPAC/firefly/stargazers","contributors_url":"https://api.github.com/repos/Caltech-IPAC/firefly/contributors","subscribers_url":"https://api.github.com/repos/Caltech-IPAC/firefly/subscribers","subscription_url":"https://api.github.com/repos/Caltech-IPAC/firefly/subscription","commits_url":"https://api.github.com/repos/Caltech-IPAC/firefly/commits{/sha}","git_commits_url":"https://api.github.com/repos/Caltech-IPAC/firefly/git/commits{/sha}","comments_url":"https://api.github.com/repos/Caltech-IPAC/firefly/comments{/number}","issue_comment_url":"https://api.github.com/repos/Caltech-IPAC/firefly/issues/comments{/number}","contents_url":"https://api.github.com/repos/Caltech-IPAC/firefly/contents/{+path}","compare_url":"https://api.github.com/repos/Caltech-IPAC/firefly/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Caltech-IPAC/firefly/merges","archive_url":"https://api.github.com/repos/Caltech-IPAC/firefly/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Caltech-IPAC/firefly/downloads","issues_url":"https://api.github.com/repos/Caltech-IPAC/firefly/issues{/number}","pulls_url":"https://api.github.com/repos/Caltech-IPAC/firefly/pulls{/number}","milestones_url":"https://api.github.com/repos/Caltech-IPAC/firefly/milestones{/number}","notifications_url":"https://api.github.com/repos/Caltech-IPAC/firefly/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Caltech-IPAC/firefly/labels{/name}","releases_url":"https://api.github.com/repos/Caltech-IPAC/firefly/releases{/id}","deployments_url":"https://api.github.com/repos/Caltech-IPAC/firefly/deployments","created_at":"2015-04-06T22:03:13Z","updated_at":"2016-05-06T19:30:48Z","pushed_at":"2016-05-21T00:54:48Z","git_url":"git://github.com/Caltech-IPAC/firefly.git","ssh_url":"git@github.com:Caltech-IPAC/firefly.git","clone_url":"https://github.com/Caltech-IPAC/firefly.git","svn_url":"https://github.com/Caltech-IPAC/firefly","homepage":null,"size":139763,"stargazers_count":3,"watchers_count":3,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":3,"forks":1,"open_issues":3,"watchers":3,"default_branch":"dev"}},"base":{"label":"Caltech-IPAC:dev","ref":"dev","sha":"6b4aa0aaa7c1f934b6a1f9bb121539f31d0bb845","user":{"login":"Caltech-IPAC","id":9708378,"avatar_url":"https://avatars.githubusercontent.com/u/9708378?v=3","gravatar_id":"","url":"https://api.github.com/users/Caltech-IPAC","html_url":"https://github.com/Caltech-IPAC","followers_url":"https://api.github.com/users/Caltech-IPAC/followers","following_url":"https://api.github.com/users/Caltech-IPAC/following{/other_user}","gists_url":"https://api.github.com/users/Caltech-IPAC/gists{/gist_id}","starred_url":"https://api.github.com/users/Caltech-IPAC/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Caltech-IPAC/subscriptions","organizations_url":"https://api.github.com/users/Caltech-IPAC/orgs","repos_url":"https://api.github.com/users/Caltech-IPAC/repos","events_url":"https://api.github.com/users/Caltech-IPAC/events{/privacy}","received_events_url":"https://api.github.com/users/Caltech-IPAC/received_events","type":"Organization","site_admin":false},"repo":{"id":33508214,"name":"firefly","full_name":"Caltech-IPAC/firefly","owner":{"login":"Caltech-IPAC","id":9708378,"avatar_url":"https://avatars.githubusercontent.com/u/9708378?v=3","gravatar_id":"","url":"https://api.github.com/users/Caltech-IPAC","html_url":"https://github.com/Caltech-IPAC","followers_url":"https://api.github.com/users/Caltech-IPAC/followers","following_url":"https://api.github.com/users/Caltech-IPAC/following{/other_user}","gists_url":"https://api.github.com/users/Caltech-IPAC/gists{/gist_id}","starred_url":"https://api.github.com/users/Caltech-IPAC/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Caltech-IPAC/subscriptions","organizations_url":"https://api.github.com/users/Caltech-IPAC/orgs","repos_url":"https://api.github.com/users/Caltech-IPAC/repos","events_url":"https://api.github.com/users/Caltech-IPAC/events{/privacy}","received_events_url":"https://api.github.com/users/Caltech-IPAC/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Caltech-IPAC/firefly","description":"","fork":false,"url":"https://api.github.com/repos/Caltech-IPAC/firefly","forks_url":"https://api.github.com/repos/Caltech-IPAC/firefly/forks","keys_url":"https://api.github.com/repos/Caltech-IPAC/firefly/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Caltech-IPAC/firefly/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Caltech-IPAC/firefly/teams","hooks_url":"https://api.github.com/repos/Caltech-IPAC/firefly/hooks","issue_events_url":"https://api.github.com/repos/Caltech-IPAC/firefly/issues/events{/number}","events_url":"https://api.github.com/repos/Caltech-IPAC/firefly/events","assignees_url":"https://api.github.com/repos/Caltech-IPAC/firefly/assignees{/user}","branches_url":"https://api.github.com/repos/Caltech-IPAC/firefly/branches{/branch}","tags_url":"https://api.github.com/repos/Caltech-IPAC/firefly/tags","blobs_url":"https://api.github.com/repos/Caltech-IPAC/firefly/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Caltech-IPAC/firefly/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Caltech-IPAC/firefly/git/refs{/sha}","trees_url":"https://api.github.com/repos/Caltech-IPAC/firefly/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Caltech-IPAC/firefly/statuses/{sha}","languages_url":"https://api.github.com/repos/Caltech-IPAC/firefly/languages","stargazers_url":"https://api.github.com/repos/Caltech-IPAC/firefly/stargazers","contributors_url":"https://api.github.com/repos/Caltech-IPAC/firefly/contributors","subscribers_url":"https://api.github.com/repos/Caltech-IPAC/firefly/subscribers","subscription_url":"https://api.github.com/repos/Caltech-IPAC/firefly/subscription","commits_url":"https://api.github.com/repos/Caltech-IPAC/firefly/commits{/sha}","git_commits_url":"https://api.github.com/repos/Caltech-IPAC/firefly/git/commits{/sha}","comments_url":"https://api.github.com/repos/Caltech-IPAC/firefly/comments{/number}","issue_comment_url":"https://api.github.com/repos/Caltech-IPAC/firefly/issues/comments{/number}","contents_url":"https://api.github.com/repos/Caltech-IPAC/firefly/contents/{+path}","compare_url":"https://api.github.com/repos/Caltech-IPAC/firefly/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Caltech-IPAC/firefly/merges","archive_url":"https://api.github.com/repos/Caltech-IPAC/firefly/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Caltech-IPAC/firefly/downloads","issues_url":"https://api.github.com/repos/Caltech-IPAC/firefly/issues{/number}","pulls_url":"https://api.github.com/repos/Caltech-IPAC/firefly/pulls{/number}","milestones_url":"https://api.github.com/repos/Caltech-IPAC/firefly/milestones{/number}","notifications_url":"https://api.github.com/repos/Caltech-IPAC/firefly/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Caltech-IPAC/firefly/labels{/name}","releases_url":"https://api.github.com/repos/Caltech-IPAC/firefly/releases{/id}","deployments_url":"https://api.github.com/repos/Caltech-IPAC/firefly/deployments","created_at":"2015-04-06T22:03:13Z","updated_at":"2016-05-06T19:30:48Z","pushed_at":"2016-05-21T00:54:48Z","git_url":"git://github.com/Caltech-IPAC/firefly.git","ssh_url":"git@github.com:Caltech-IPAC/firefly.git","clone_url":"https://github.com/Caltech-IPAC/firefly.git","svn_url":"https://github.com/Caltech-IPAC/firefly","homepage":null,"size":139763,"stargazers_count":3,"watchers_count":3,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":3,"forks":1,"open_issues":3,"watchers":3,"default_branch":"dev"}},"_links":{"self":{"href":"https://api.github.com/repos/Caltech-IPAC/firefly/pulls/87"},"html":{"href":"https://github.com/Caltech-IPAC/firefly/pull/87"},"issue":{"href":"https://api.github.com/repos/Caltech-IPAC/firefly/issues/87"},"comments":{"href":"https://api.github.com/repos/Caltech-IPAC/firefly/issues/87/comments"},"review_comments":{"href":"https://api.github.com/repos/Caltech-IPAC/firefly/pulls/87/comments"},"review_comment":{"href":"https://api.github.com/repos/Caltech-IPAC/firefly/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Caltech-IPAC/firefly/pulls/87/commits"},"statuses":{"href":"https://api.github.com/repos/Caltech-IPAC/firefly/statuses/611fc933864b73241a82592872348d0c1ea7214e"}}}}
{"actor":{"display_login":"robyww"}}