User Tools

Site Tools


internal:administration:idl

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
internal:administration:idl [2024/12/13 15:09] janinternal:administration:idl [2025/11/25 14:42] (current) – [symboltypes] jan
Line 182: Line 182:
 path in single (') or double (") quotation marks ! path in single (') or double (") quotation marks !
  
-==== execute shell command ====+==== execute shell command : SPAWN ====
  
   SPAWN [, "<Command>" [, Result] [, ErrResult] ]   SPAWN [, "<Command>" [, Result] [, ErrResult] ]
Line 192: Line 192:
   IDL>SPAWN , 'pwd'   IDL>SPAWN , 'pwd'
  
 +In some cases you may get error message from your program. For example curl:
 +  IDL> spawn, 'curl -V'
 +  curl: /opt/nv5/idl90/bin/bin.linux.x86_64/libcurl.so.4: no version information available (required by curl)
 +  ...
 +  WARNING: curl and libcurl versions do not match. Functionality may be affected.
 +
 +The first and the last lines tell you that %%libcurl.so.4%% from the %%/opt/nv5/idl90/...%% path makes problems. 
 +But why should curl try to load libraries from /opt/nv5/... i.e. the IDL folder ?
 +
 +Another example is ghostscript (gs) - which does not even work:
 +  IDL> SPAWN, 'gs --version'
 +  gs: /opt/nv5/idl90/bin/bin.linux.x86_64/libstdc++.so.6: version `GLIBCXX_3.4.32' not found (required by /lib/x86_64-linux-gnu/libgs.so.10)
 +
 +Again ghostscript tries to load lubraries from /opt/nv5/... 
 +
 +To get around you have to understand where the system seeks libraries.
 +This is explained e.g. here: [[https://askubuntu.com/questions/1500913/find-default-library-paths-location-in-ubuntu]], or in the man pages of [[https://man7.org/linux/man-pages/man8/ld.so.8.html | ld.so]]. To ensure that IDL only uses libraries of a certain version they set the variable LD_LIBRARY_PATH to the idl library folders. It is not set in standard bash environment, but in the SPAWN environment as it is a subrpocess of IDL:
 +  IDL> SPAWN, 'echo $LD_LIBRARY_PATH'
 +  /opt/nv5/idl90/bin/bin.linux.x86_64:/opt/nv5/idl90/bin/bin.linux.x86_64/dm/lib:/opt/nv5/idl90/bin/bin.linux.x86_64/jre/lib/server:/opt/nv5/idl90/bin/bin.linux.x86_64/jre/lib/server/..:/opt/nv5/idl90/bin/bin.linux.x86_64/jre/lib/server/../native_threads
 +
 +We can ask Linux where we can find the libraries needed:
 +  $whereis libcurl.so.4
 +  libcurl.so.4: /usr/lib/x86_64-linux-gnu/libcurl.so.4
 +and
 +  $whereis libstdc++.so.6
 +  libstdc++.so.6: /usr/lib/x86_64-linux-gnu/libstdc++.so.6
 +
 +We have several possibilities:
 +
 +  * adapt the LD_LIBRARY_PATH from within IDL before invoking SPAWN. This was proposed to me : [[https://www.nv5geospatialsoftware.com/Support/Forums/aft/8650 in the IDL forum]] for the PAtH variable but maybe IDL will have problems with that. And you should do this only once to avoid an extremly long path with only your prepended entry.
 +      %%SETENV, 'LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu/:'+GETENV('LD_LIBRARY_PATH')%%
 +
 +  * Alternatively adapt LD_LIBRARY_PATH within the SPAWN environment when calling your program
 +      %%SPAWN, 'LD_LIBRARY_PATH=/usr/lib:$LD_LIBRARY_PATH; your_command_here'%%
 +
 +  * or even simpler unset this path variable in SPAWN: it is not needed as we are not doing IDL specific things, and when SPAWN is finished this is forgotten again.
 +      %%SPAWN, 'unset LD_LIBRARY_PATH; your_command_here'%%
 +
 +According to IDL help about [[https://www.nv5geospatialsoftware.com/docs/Environment_Variables.html | Environment variables]] LD_LIBRARY_PATH is used for the Java libraries - i.e. probably for the IDE and its graphical interface. That means if you do not use the IDE the first solution will have no problems.
 +
 +Check with curl:
 +    SPAWN, 'unset LD_LIBRARY_PATH ; curl -V'
 +    curl 8.5.0 (x86_64-pc-linux-gnu) libcurl/8.5.0 OpenSSL/3.0.13 zlib/1.3 brotli/1.1.0 zstd/1.5.5 libidn2/2.3.7 libpsl/0.21.2 (+libidn2/2.3.7) libssh/0.10.6/openssl/zlib nghttp2/1.59.0 librtmp/2.3 OpenLDAP/2.6.7
 +    ...
 +
 +Check with ghostscript
 +    SPAWN, 'unset LD_LIBRARY_PATH ; gs --version'
 +    10.02.1 
  
 +=> WORKS!
  
 ==== compile and run idl programs ==== ==== compile and run idl programs ====
Line 1796: Line 1845:
    1 => Plus sign (+)     1 => Plus sign (+) 
    2 => Asterisk (*)     2 => Asterisk (*) 
-   3 => Period (.) +   3 => one pixel dot (.) 
    4 => Diamond     4 => Diamond 
-   5 => Triangle 'up'+   5 => Triangle up (if symsize>0)  or down if symsize<0
    6 => Square     6 => Square 
    7 => X     7 => X 
Line 1992: Line 2041:
 You may also use the complex greek (2lines per stroke to make letter more bold) You may also use the complex greek (2lines per stroke to make letter more bold)
   * a greek psi\\ %%!7w!X%%    * a greek psi\\ %%!7w!X%% 
 +
 +One may define constants for the different letters:
 +  c_greek_font = '!4' ; simplex greek
 +  ;c_greek_font = '!7' ; complex greek
 +  c_alpha   = c_greek_font+'a!X'
 +  c_beta    = c_greek_font+'b!X'
 +  c_gamma   = c_greek_font+'c!X'
 +  c_delta   = c_greek_font+'d!X'
 +  
 +  c_epsilon = c_greek_font+'e!X'
 +  c_zeta    = c_greek_font+'f!X'
 +  c_eta     = c_greek_font+'g!X'
 +  c_theta   = c_greek_font+'h!X'
 +  
 +  c_iota    = c_greek_font+'i!X'
 +  c_kappa   = c_greek_font+'j!X'
 +  c_lambda  = c_greek_font+'k!X'
 +  c_mu      = c_greek_font+'l!X'
 +  
 +  c_nu      = c_greek_font+'m!X'
 +  c_xi      = c_greek_font+'n!X'
 +  c_omikron = c_greek_font+'o!X'
 +  c_pi      = c_greek_font+'p!X'
 +  
 +  c_rho     = c_greek_font+'q!X'
 +  c_sigma   = c_greek_font+'r!X'
 +  c_tau     = c_greek_font+'s!X'
 +  c_upsilon = c_greek_font+'t!X'
 +  
 +  c_phi     = c_greek_font+'u!X'
 +  c_xi      = c_greek_font+'v!X'
 +  c_psi     = c_greek_font+'w!X'
 +  c_omega   = c_greek_font+'x!X'
 +  
 +  c_infinity= c_greek_font+'y!X'
 +  
 +  ; usage
 +  xyouts, 0,0, c_phi+'('+ c_theta+') = '+ c_delta
  
  
Line 2043: Line 2130:
  
 You may generate super- and sub-scripts and further primitve type setting command based on  You may generate super- and sub-scripts and further primitve type setting command based on 
-[[http://chu.berkeley.edu/dokuwiki/chu:soft:fontart|Grandle and Nystrom (1980)]]((Grandle and Nystrom, 1980, A method for usage of a large calligraphy set under RSX-11M. Grandle, R.E. and Nystrom, P.A. Proceedings of the Digital Equipment Computer Users Society, November 1980, 391-395.)). This is also used in other software packeges see e.g. the documentation of  [[http://www.nag.co.uk/visual/IE/iecbb/DOC/html/unix-ref/stan/nagtext.htm|NAG]] e.g.  [[http://www.ualberta.ca/AICT/RESEARCH/NAG/Explorer5doc/html/unix-ref/stan/nagtext.htm|here]] or [[http://www.nag.co.uk/visual/IE/iecbb/DOC/html/unix-ref/stan/nagtext.htm|here]].+[[http://chu.berkeley.edu/dokuwiki/chu:soft:fontart|Grandle and Nystrom (1980)]]((Grandle and Nystrom, 1980, A method for usage of a large calligraphy set under RSX-11M. Grandle, R.E. and Nystrom, P.A. Proceedings of the Digital Equipment Computer Users Society, November 1980, 391-395.)). This is also used in other software packages see e.g. the documentation of  <del>[[http://www.nag.co.uk/visual/IE/iecbb/DOC/html/unix-ref/stan/nagtext.htm|NAG]] e.g.  [[http://www.ualberta.ca/AICT/RESEARCH/NAG/Explorer5doc/html/unix-ref/stan/nagtext.htm|here]] or [[http://www.nag.co.uk/visual/IE/iecbb/DOC/html/unix-ref/stan/nagtext.htm|here]]</del> --- sorry all the links before are dead.  
 +Here are some still alive NAG docs pages: 
 +[[http://bh0.phas.ubc.ca/Doc/explorer/doc/html/doc/ref/stan/nagtext.htm|NagText]],  
 +[[https://sites.cc.gatech.edu/scivis/iris/doc/ref/stan/nagtext.htm|NAGText@gatech.edu]],  
 +[[https://sites.cc.gatech.edu/scivis/iris/doc/ref/stan/naggraph.htm|NAGGraph@gatech.edu]].
  
-The following commands are available (see also IDL help [[http://harrisgeospatial.com/docs/embedded_formatting_comm.html|Embedded Formatting Commands]])((find it under 'fonts' in the help)):+The following commands are available (see also IDL help [[https://www.nv5geospatialsoftware.com/docs/Embedded_Formatting_Comm.html|Embedded Formatting Commands]])((find it under 'fonts' in the help)):
  
   * supersuperscript  !U ('Up' faktor 0.62)   * supersuperscript  !U ('Up' faktor 0.62)
Line 2098: Line 2189:
       * $\cdot$: %%'!9'+string(byte('056'O))+'!X'%% \\ select special and math font (!9), select the cdot symbol (string(byte(...))), return to previous font (!X)       * $\cdot$: %%'!9'+string(byte('056'O))+'!X'%% \\ select special and math font (!9), select the cdot symbol (string(byte(...))), return to previous font (!X)
  
-    * integral sign with intefration boundaries+    * integral sign with integration boundaries
       * $\int_a^b dx$ : %%'!9'+string(byte(105))+'!X!S!Da!N!R!Ub!N dx'%% \\ select special math font (!9), integral sign (string(byte(105))), restore previous font (!X), save position (!S), lower boundary (!Da!N), restore position, upper boundary (!Ub!N), dx. \\ the inteegral sign used here is rahter small alternatively one can use string(byte(73)) also in the MAth and special font (!9) but it is rather large ...       * $\int_a^b dx$ : %%'!9'+string(byte(105))+'!X!S!Da!N!R!Ub!N dx'%% \\ select special math font (!9), integral sign (string(byte(105))), restore previous font (!X), save position (!S), lower boundary (!Da!N), restore position, upper boundary (!Ub!N), dx. \\ the inteegral sign used here is rahter small alternatively one can use string(byte(73)) also in the MAth and special font (!9) but it is rather large ...
  
Line 2113: Line 2204:
     * The position of the fraction line must be corrected a bit upward therefore the %%dy%%((y is the position of the base line on which printing occurs. The fraction line is a bit less then half a character height above)). You may try to calculate %%dy%% but at a certain point it becomes incredible complex ...     * The position of the fraction line must be corrected a bit upward therefore the %%dy%%((y is the position of the base line on which printing occurs. The fraction line is a bit less then half a character height above)). You may try to calculate %%dy%% but at a certain point it becomes incredible complex ...
  
-For more examples have a look at [[http://harrisgeospatial.com/docs/formatting_command_examp.html#fonts_2203613354_1050540|Formatting Command Examples]].+For more examples have a look at [[https://www.nv5geospatialsoftware.com/docs/formatting_command_examp.html#fonts_2203613354_1050540|Formatting Command Examples]].
  
  
Line 2414: Line 2505:
 ==== transparency ==== ==== transparency ====
  
-IDL does not know transparent overlays but on pixel based devices you can implement it with TVRD and TVRD.+IDL does not know transparent overlays but on pixel based devices you can implement it with TVRD and TV.
 Lets assume you want to put a bitmap BMP with size Nx, Ny at a position x0 y0 (pixels) with a tranparency factor of q_tra: Lets assume you want to put a bitmap BMP with size Nx, Ny at a position x0 y0 (pixels) with a tranparency factor of q_tra:
  
Line 2583: Line 2674:
 %%-dGraphicsAlphaBits=1%% avoids gridlines after rastering (http://www.idlcoyote.com/ps_tips/psstripes.html), \\ %%-dGraphicsAlphaBits=1%% avoids gridlines after rastering (http://www.idlcoyote.com/ps_tips/psstripes.html), \\
 %%-dEPSCrop%% crops the image at the bounding box. %%-dEPSCrop%% crops the image at the bounding box.
 +
 +You can execute gs from within IDL with the SPAWN command. As of IDL 9.x you need to prepend a ''unset LD_LIBRARY_PATH'' because IDL try to ensure its own (outdated) libraries for any spawn call:
 +  SPAWN, 'unset LD_LIBRARY_PATH; gs -dSAFER -dBATCH -dNOPAUSE -sDEVICE=png16m -r120 -dTextAlphaBits=4 -dGraphicsAlphaBits=1 -dEPSCrop -sOutputFile='+plt_name+'.png '+pl_name+'.eps', result, err_result
 +
 ==== postscript -> PDF ==== ==== postscript -> PDF ====
  
Line 3153: Line 3248:
 A one dimensional histogram is e.g. generated with A one dimensional histogram is e.g. generated with
  
-  histo = histogram( data , binsize=bin, locations = classes , /nan )+  binsize = 0.1 
 +  histo = histogram( data , binsize=binsize, locations = classes , /nan )
  
 the classes variable will contain the **lower borders** of the bins with the first bin starting at min(data). \\ the classes variable will contain the **lower borders** of the bins with the first bin starting at min(data). \\
Line 3172: Line 3268:
  
 or you write an own plot-histo procedure ... or you ask jan :-) ... or you write an own plot-histo procedure ... or you ask jan :-) ...
 +
 +
 +A histogram with geometric spacing, i.e. each bin is by a factor q_bin larger than the previous.\\
 +In this case data points lower or equal to zero are not allowed:
 +  q_bin = 2.0
 +  log_binsize = alog10(q_bin)
 +  histo = histogram( alog10(data[where(data gt 0)]), binsize=log_binsize, locations = log_bins, /nan )
 +  classes = 10^log_bins
 +
 +Plotting shall use then logarithmic scaling for the x-axes:
 +
 +    plot, classes , histo , psym=10, $
 +      xtitle = 'class (unit)', $
 +      ytitle = 'freq.', $
 +      /xlog
 +
  
 === 2-D histogram === === 2-D histogram ===
Line 3182: Line 3294:
   max_data_1 = max(data_1, /nan )   max_data_1 = max(data_1, /nan )
   N_bins_1 = fix((max_data_1-min_data_1)/bin_size_1)+1   N_bins_1 = fix((max_data_1-min_data_1)/bin_size_1)+1
-  bins_1 = min_data_1 + (findgen(N_bins_1) + 0.5) * bin_size_1 ; output of histo refers to lower border of bins => add 1/2binsize to center them in bin+  ; output of histo refers to lower border of bins => add 1/2binsize to center them in bin 
 +  bins_1 = min_data_1 + (findgen(N_bins_1) + 0.5) * bin_size_1 
        
   ; set bin-size, min and max and vector with bin-borders for data set 2   ; set bin-size, min and max and vector with bin-borders for data set 2
Line 3189: Line 3302:
   max_data_2 = max(data_2, /nan )   max_data_2 = max(data_2, /nan )
   N_bins_2 = fix((max_data_2-min_data_2)/bin_size_2)+1   N_bins_2 = fix((max_data_2-min_data_2)/bin_size_2)+1
 +  ; output of histo refers to lower border of bins => add 1/2binsize to center them in bin
   bins_2 = min_data_2 + (findgen(N_bins_2) + 0.5)*bin_size_2   bins_2 = min_data_2 + (findgen(N_bins_2) + 0.5)*bin_size_2
        
internal/administration/idl.1734102545.txt.gz · Last modified: by jan