internal:administration:idl
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| internal:administration:idl [2025/06/19 12:00] – [Fonts] jan | internal: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 [, "< | ||
| Line 192: | Line 192: | ||
| IDL> | IDL> | ||
| + | In some cases you may get error message from your program. For example curl: | ||
| + | IDL> spawn, 'curl -V' | ||
| + | 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 %%/ | ||
| + | But why should curl try to load libraries from / | ||
| + | |||
| + | Another example is ghostscript (gs) - which does not even work: | ||
| + | IDL> SPAWN, 'gs --version' | ||
| + | gs: / | ||
| + | |||
| + | Again ghostscript tries to load lubraries from / | ||
| + | |||
| + | To get around you have to understand where the system seeks libraries. | ||
| + | This is explained e.g. here: [[https:// | ||
| + | IDL> SPAWN, 'echo $LD_LIBRARY_PATH' | ||
| + | / | ||
| + | |||
| + | We can ask Linux where we can find the libraries needed: | ||
| + | $whereis libcurl.so.4 | ||
| + | libcurl.so.4: | ||
| + | and | ||
| + | $whereis libstdc++.so.6 | ||
| + | libstdc++.so.6: | ||
| + | |||
| + | We have several possibilities: | ||
| + | |||
| + | * adapt the LD_LIBRARY_PATH from within IDL before invoking SPAWN. This was proposed to me : [[https:// | ||
| + | %%SETENV, ' | ||
| + | |||
| + | * Alternatively adapt LD_LIBRARY_PATH within the SPAWN environment when calling your program | ||
| + | %%SPAWN, ' | ||
| + | |||
| + | * 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; | ||
| + | |||
| + | According to IDL help about [[https:// | ||
| + | |||
| + | Check with curl: | ||
| + | SPAWN, 'unset LD_LIBRARY_PATH ; curl -V' | ||
| + | curl 8.5.0 (x86_64-pc-linux-gnu) libcurl/ | ||
| + | ... | ||
| + | |||
| + | 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 | + | 5 => Triangle up (if symsize> |
| 6 => Square | 6 => Square | ||
| 7 => X | 7 => X | ||
| Line 1994: | Line 2043: | ||
| One may define constants for the different letters: | One may define constants for the different letters: | ||
| - | | + | |
| - | ; _greek_font | + | ;c_greek_font |
| - | | + | |
| - | | + | |
| - | | + | |
| - | | + | |
| | | ||
| - | | + | |
| - | | + | |
| - | | + | |
| - | | + | |
| | | ||
| - | | + | |
| - | | + | |
| - | | + | |
| - | | + | |
| | | ||
| - | | + | |
| - | | + | |
| - | | + | |
| - | | + | |
| | | ||
| - | | + | |
| - | | + | |
| - | | + | |
| - | | + | |
| - | + | ||
| - | | + | |
| - | | + | |
| - | | + | |
| - | | + | |
| - | + | ||
| - | | + | |
| - | ; _ell = _c_greek_font+' | + | |
| | | ||
| ; usage | ; usage | ||
| - | xyouts, 0,0, _phi+' | + | xyouts, 0,0, c_phi+' |
| Line 2458: | 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 2627: | Line 2674: | ||
| %%-dGraphicsAlphaBits=1%% avoids gridlines after rastering (http:// | %%-dGraphicsAlphaBits=1%% avoids gridlines after rastering (http:// | ||
| %%-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 '' | ||
| + | SPAWN, 'unset LD_LIBRARY_PATH; | ||
| + | |||
| ==== postscript -> PDF ==== | ==== postscript -> PDF ==== | ||
| Line 3197: | 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 ) | + | |
| + | | ||
| 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 3216: | 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, | ||
| + | classes = 10^log_bins | ||
| + | |||
| + | Plotting shall use then logarithmic scaling for the x-axes: | ||
| + | |||
| + | plot, classes , histo , psym=10, $ | ||
| + | xtitle = 'class (unit)', | ||
| + | ytitle = ' | ||
| + | /xlog | ||
| + | |||
| === 2-D histogram === | === 2-D histogram === | ||
| Line 3226: | 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)/ | N_bins_1 = fix((max_data_1-min_data_1)/ | ||
| - | | + | ; 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 3233: | 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)/ | N_bins_2 = fix((max_data_2-min_data_2)/ | ||
| + | ; 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.1750334426.txt.gz · Last modified: by jan
