• Home (current)
  • वर्तमान निदेशक => /usr/share/slsh/
  • सूचना एवं अपलोड
    Info Server
Indian Cyber Force
Folders रचयन्तु सञ्चिकां रचयन्तु RansomWeb लॉगआउट
Current File : //usr/share/slsh/histogram.sl
% This file not only provides access to the module, it also provides several
% other functions that are easier to implement in slang.  These include:
%
%   whist1d     : weighted 1-d histogram
%   whist2d     : weighted 2-d histogram
%   hist2d_rebin: Rebins a 2-d histogram
%
#ifeval _slang_version < 20000
if (current_namespace () != "")
  import ("histogram", current_namespace ());
else
#endif
 import ("histogram");

define whist1d ()
{
   variable func = NULL;
   variable rev = NULL;

   switch (_NARGS)
     {
      case 4:
	rev = ();
     }
     {
      case 5:
	(rev, func) = ();
     }
     {
	if (_NARGS != 3)
	  usage ("h = %s (pnts, weights, bin-edges [,rev-indices [,func]])", 
		 _function_name);
     }
   
   variable pnts, w, edges;
   (pnts, w, edges) = ();
   
   if (func == NULL)
     func = &sum;

   variable r;
   () = hist1d (pnts, edges, &r);
   
   variable n = length (edges);
   variable h = Double_Type [n];

   _for (0, n-1, 1)
     {
	variable i = ();
	h[i] = (@func) (w[r[i]]);
     }

   if (rev != NULL)
     @rev = r;
   
   return h;
}

define whist2d ()
{
   variable rev = NULL, func = NULL;
   switch (_NARGS)
     {
      case 6:
	rev = ();
     }
     {
      case 7:
	(rev, func) = ();
     }
     {
	if (_NARGS != 5)
	  usage ("img=%s(xpnts, ypnts, weights, xgrid, ygrid [,rev [,func]])",
		 _function_name ());
     }

   variable x, y, w, xgrid, ygrid;
   (x, y, w, xgrid, ygrid) = ();

   if (func == NULL)
     func = &sum;

   variable r; 
   () = hist2d (x, y, xgrid, ygrid, &r);

   variable nx = length (xgrid);
   variable ny = length (ygrid);
   variable img = Double_Type[nx, ny];
   _for (0, nx-1, 1)
     {
	variable i = ();
	_for (0, ny-1, 1)
	  {
	     variable j = ();
	     img[i,j] = (@func)(w[r[i,j]]);
	  }
     }

   if (rev != NULL)
     @rev = r;

   return img;
}

define hist2d_rebin ()
{
   if (_NARGS != 5)
     usage ("new_ijhist=%s(new_igrid,new_jgrid,old_igrid,old_jgrid,old_ijhist)",
	    _function_name);

   variable new_igrid, new_jgrid, old_igrid, old_jgrid, old_hist;
   (new_igrid, new_jgrid, old_igrid, old_jgrid, old_hist) = ();
   
   variable new_ilen = length (new_igrid);
   variable new_jlen = length (new_jgrid);
   variable old_ilen = length (old_igrid);
   variable old_jlen = length (old_jgrid);
   
   variable h_i = hist1d_rebin (new_jgrid, old_jgrid, old_hist[0,*]);
   variable type = _typeof (h_i);
   
   variable new_hist = @Array_Type (type, [old_ilen, new_jlen]);
   
   new_hist[0,*] = h_i;
   _for (1, old_ilen-1, 1)
     {
	variable i = ();
	new_hist[i,*] = hist1d_rebin (new_jgrid, old_jgrid, old_hist[i,*]);
     }
   old_hist = new_hist;
   new_hist = @Array_Type (type, [new_ilen, new_jlen]);
   
   _for (0, new_jlen-1, 1)
     {
	variable j = ();
	new_hist[*,j] = hist1d_rebin (new_igrid, old_igrid, old_hist[*,j]);
     }
   
   return new_hist;
}


#ifexists add_doc_file
$1 = path_concat (path_concat (path_dirname (__FILE__), "help"),
		  "histogram.hlp");
if (NULL != stat_file ($1))
  add_doc_file ($1);
#endif

provide ("histogram");
gorilla – Verilere bak
Menu
  • Top 10

Verilere bak

Follow us
  • facebook
  • twitter
Search
Login
Create
Menu

Verilere bak

Login

You are here:

  1. Home
  2. Tag Archives: gorilla

gorilla

Latest stories

Can You Get Through These 12 Sexy Photos Without Saying WOW? (Open list)

  • facebook
  • twitter

Arşivler

Kategoriler

Disclaimer

This demo site is only for demonstration purposes. All images are copyrighted to their respective owners. All content cited is derived from their respective sources.

© 2017 bring the pixel. Remember to change this

  • Home
  • Contact us
Back to Top
Close
  • Top 10
  • Home
  • Animals
  • Funny
  • WOW
  • WTF
  • Features
  • facebook
  • twitter
Create

Log In

Sign In

Forgot password?

Forgot password?

Enter your account data and we will send you a link to reset your password.

Back to Login

Your password reset link appears to be invalid or expired.

Log in

Privacy Policy

Accept

Add to Collection

  • Public collection title

  • Private collection title

No Collections

Here you'll find all collections you've created before.

Hey Friend!
Before You Go…

Get the best viral stories straight into your inbox before everyone else!

Don't worry, we don't spam

Close

Newsletter

Don’t miss out on new posts!

Don't worry, we don't spam

Close