in idlde, go to window>>preferences>>General>>Editors>>text editors and place a checkmark on “show line numbers” and then go to bottom and apply and save
very hard to find this –googling and manuals did not help –joel
in idlde, go to window>>preferences>>General>>Editors>>text editors and place a checkmark on “show line numbers” and then go to bottom and apply and save
very hard to find this –googling and manuals did not help –joel
Solution from:
https://stackoverflow.com/questions/25167780/output-2-array-values-to-a-text-file-using-idl
IDL> x = findgen(10)
IDL> y = findgen(10) * 2
IDL> print, transpose([[x], [y]]), format='(2F)'
--Joel
In our galactic magnetic field project, color plots seem to fail sporadically, leaving plots with blank places where there should be colored symbols or lines. Very frustrating! I am finding this with AO_ATNF_Pulsars_RM_Sag_Region1a.pro
So I tried manually to play around with this from the IDL command line, basically trying to duplicate it. Note that the above program uses cgcolor multiple times to set up definitions of say red to then be used in plot procedure (without quotes, e.g. plot,x,y,red ). Note comments in above
say we needed to use cgcolor because regular idl colors
were not working. Note all this is with plot procedure, and
newer plot function may not have any of these probs! New programs should use the latter.
From command line, if I do the following:
x=findgen(10)
y=findgen(10)
set_plot,’ps’ (I think needs it only once)
device,filename=’help.ps’ (puts the file in home directory)
Red =cgColor(“Red”, !D.Table_Size-4) (stolen from pgm, and cgcolor is a coyote routine [there are such calls for every color used])
plot, x, y, color=red (makes every bit of plot red)
device,/close
The above made a red plot in the file ~help.ps .
And then FWIW when I reran the AO_ATNF . . . Sag..1a.pro,
the two plots’ colors were there. I’m not saying cause and
effect, but at least in this case a rerun after above jimmying
brought the colors back. I am guessing that somehow I
am not properly totally initializing colors when I run the
program, so if something color-related is left in a funny
state by a previous run, then the next program run does
not automatically fix it.
Coyote has some suggestions at
http://www.idlcoyote.com/color_tips/redps.html ,
including:
Set_Plot, 'PS' Device, DECOMPOSED=1, COLOR=1, BITS_PER_PIXEL=8, filename='help.ps' (Joel added the filename part.)
and he claims that all the above are needed for color to
work, so maybe the program’s lack of such a full Device command is the problem. However the above advice is old and I’m not
sure if today’s idl might need say 24 bits per pixel???? But
the color=1 command sounds like it is turning on color! Decomposed=1 turns on decomposed colors which I think means R,G,B are expressed separately. That is documented here and there but I’m not sure if our cgcolor routines expect that value, so, be careful!
Sorry I don’t have the definitive fix but hopefully the user can create a workaround with some subset of above, if she suddenly loses color on plots that were colored in previous program runs!
–Joel
OK. idl has some built-in unix-like commands, but then others require a ‘$’ beforehand which I think summons the unix shell. The various unix-like commands that an idl user might like are a mixture thereof, so see below whether or not there is a $ (See also a third option, spawn, below.):
cd, ‘/data/psrdata/ note no $ : this is a native idl command made to look like its unix cousin
pwd ” ” ” ” ” (This and previous command often go together ,
since this one returns the “present working directory” which should
verify that your cd command did as you wished! (There is supposedly a
way to get the idl prompt to show the pwd but I haven’t yet figured it out.)
printd or popd or pushd are all native idl directory-oriented commands made to look like their unix cousins (or in printd case, just print the current directory name – no unix cousin exists.)
$ls Needs the dollar sign which I think invoked the unix shell.
The idl spawn command can also be useful:
spawn,’ls -als | grep arecibowapp’ is a way to do the idl version of the unix ls with flags, and even then pipe it into another command. This looks like the most flexible!.
spawn,’ps aux’ ditto
using breakpoints on idlde over vncviewer (as opposed to chicken-of-the-vnc) was fraught. The usual key combinations would not place breakpoints anywhere. But I eventually learned that:
DOUBLE CLICKING ON GRAY BORDER AT VERY LEFT OF DESIRED LINE TOGGLES BREAKPOINT
Here is a harder way that I learned before above red easy way:
Here is an even harder way to do it from keyboard:
help,/breakpoint will give a list of existing breakpoints
cd, ‘full path to desired directory’ will change idl’s current directory from users home directory (the default) to another. remember apostrophes CASE SENSITIVE
printd prints the current directory
IDL> printd
Current Directory: /data/psrdata/arecibopuppi/B1913+16/2019Aug
Directory stack is empty.
breakpoint,/set, ‘filename inside of current idl directory path [see printd above to discover current path value] ‘, 150 (use apostrophes, note final value is linenumber) CASE SENSITIVE
i think i did not see the red circle on line 150 of idlde until i recompiled.
check out help,/breakpoint to see a list of current breakpoints, including their “index” which can be used in some other breakpoint commands like breakpoint,/clear,1 (index 1)
IDL> help,/breakpoint
Index Line Attributes File
1 150 Pro=PLOTADAYSRMTOT /data/psrdata/arecibopuppi/B1913+16/2019Aug/plotAdaysRMtot.pro
I have noticed slight object-oriented differences in plotting on mirzam (v8.6) vs
on deneb or canopus (v8.3)
–joel
Carl Thomas got running DIALOG_PICKFILE in IDL, which enables one to point and click one’s way to selecting a desired file, say for processing. I (Joel ) embellished it a little to get it to allow choice of both file AND subdir. See spectraoverlay.pro in /data/psrdata/arecibowappHI/overlayLAB-EBHIS/
idl 8.3 is on deneb and canopus. I have no maintenance contract on them any more, so they are frozen at that version. They reside on local disks on each machine at /usr/local/exelis. . .
i dropped maint on mirzam for about 10 months in 2016(?). When I picked it up again, we loaded idl 8.6 into /usr/local/harris/ . . .
–Joel
At least for now, function wmeanandsig.pro is in /data/psrdata/rmgalprojs
If you create an array of RM and an equal-sized array of sig_RM (with no ∞ sig_RM’s), then:
wmean_and_sdm=wmeanandsig(RM,
will put the weighted mean and weighted sdm into a two-element array called wmean_and_sdm
(and the way functions work, you can replace the variable that above i call “wmean_and_sdm”, with
a variable of any name you wish)
Right now there is a “driver” program in the same directory, called, “wmeanandsigDRIVER.pro” . It
is a module that tests wmeanandsig.pro . I used it extensively to do so, to the point where I can now
call wmeanandsig.pro “ready to go” . (Luckily the NIST web pages give sample input/output for weighted
mean and for weighted SDM, which I endeavored to match.)
Caution: In 2018 April, I changed the calculation of the weighted SDM. Previously, we had used the NIST definition, which changed the data weights so as to achieve reduced χ^2 to 1. (The NIST webpage gave a formula for wgtd SD but did not note that it included this readjustment. ) In 2018 April, I changed the calculation to be
σ^2_wgtdmean = 1 / [ Σ 1/σ^2_j]. Note that this calculation depends entirely on the σ_j’s of the data points, and nothing else (such as deviation from mean).