X
PrevPrev Go to previous topic
NextNext Go to next topic
Last Post 24 May 2008 11:35 AM by  anon
Plotting blocked dataset
 1 Replies
Sort:
You are not authorized to post a reply.
Author Messages

anon



New Member


Posts:
New Member


--
24 May 2008 11:35 AM
    I'm a complete novice to IDL, and would appreciate someone's input how to create a plot using the dataset that I'm dealing with. I have a dataset which looks the posting below. Each block of data contains 20 lines (as indicated in field3), and there are about 5000 blocks. I'm interested in plotting Field2 vs Field5 for each Field3 value. I just don't know how to read my ascii file into IDL array when trying to skip 20 lines for each block. Any help will be greatly appreciate it. Thank you. Field 1 Field 2 Field3 Field4 Field5 Field6 3.0000000 3.0000000 1.00000000 1.8000000 1.49780144E-29 1.40180857E-29 3.0000000 3.0000000 2.0000000 3.5999999 2.73563844E-29 9.11792036E-30 3.0000000 3.0000000 3.0000000 5.4000001 1.71819583E-29 1.29877373E-29 3.0000000 3.0000000 4.0000000 7.1999998 5.14621060E-29 2.58542102E-29 3.0000000 3.0000000 5.0000000 9.0000000 1.72799382E-28 4.28367354E-29 3.0000000 3.0000000 6.0000000 10.800000 4.11793048E-28 6.12365856E-29 3.0000000 3.0000000 7.0000000 12.600000 7.86878642E-28 7.90947410E-29 3.0000000 3.0000000 8.0000000 14.400000 1.30395097E-27 9.54296181E-29 3.0000000 3.0000000 9.0000000 16.200001 1.96201937E-27 1.09999465E-28 3.0000000 3.0000000 10.0000000 18.000000 2.75753070E-27 1.22945758E-28 3.0000000 3.0000000 11.000000 19.799999 3.68653421E-27 1.34553434E-28 3.0000000 3.0000000 12.000000 21.600000 4.74551141E-27 1.45132628E-28 3.0000000 3.0000000 13.000000 23.400000 5.93158882E-27 1.54968581E-28 3.0000000 3.0000000 14.000000 25.200001 7.24250578E-27 1.64305104E-28 3.0000000 3.0000000 15.000000 27.000000 8.67649698E-27 1.73345600E-28 3.0000000 3.0000000 16.000000 28.799999 1.02321692E-26 1.82259742E-28 3.0000000 3.0000000 17.000000 30.600000 1.19083985E-26 1.91188474E-28 3.0000000 3.0000000 18.000000 32.400002 1.37042657E-26 2.00246616E-28 3.0000000 3.0000000 19.000000 34.200001 1.56189960E-26 2.09524735E-28 3.0000000 3.0000000 20.000000 36.000000 1.76519245E-26 2.19092346E-28 4.0000000 4.0000000 1.00000000 1.8000000 1.53348801E-29 1.78519668E-29 4.0000000 4.0000000 2.0000000 3.5999999 3.46163458E-29 2.02830531E-29 4.0000000 4.0000000 3.0000000 5.4000001 7.22448521E-29 1.59659517E-29 4.0000000 4.0000000 4.0000000 7.1999998 6.50174810E-29 1.05016589E-29 4.0000000 4.0000000 5.0000000 9.0000000 5.20087331E-29 1.42916039E-29 4.0000000 4.0000000 6.0000000 10.800000 1.07453662E-28 2.78727864E-29 4.0000000 4.0000000 7.0000000 12.600000 2.97411274E-28 4.79691161E-29 4.0000000 4.0000000 8.0000000 14.400000 6.64705061E-28 7.09946588E-29 4.0000000 4.0000000 9.0000000 16.200001 1.22991254E-27 9.45154213E-29 4.0000000 4.0000000 10.0000000 18.000000 1.99964414E-27 1.17201901E-28 4.0000000 4.0000000 11.000000 19.799999 2.97327183E-27 1.38487507E-28 4.0000000 4.0000000 12.000000 21.600000 4.14708762E-27 1.58254566E-28 4.0000000 4.0000000 13.000000 23.400000 5.51662141E-27 1.76571905E-28 4.0000000 4.0000000 14.000000 25.200001 7.07750597E-27 1.93611270E-28 4.0000000 4.0000000 15.000000 27.000000 8.82575732E-27 2.09626713E-28 4.0000000 4.0000000 16.000000 28.799999 1.07579635E-26 2.24893464E-28 4.0000000 4.0000000 17.000000 30.600000 1.28713658E-26 2.39641657E-28 4.0000000 4.0000000 18.000000 32.400002 1.51637617E-26 2.54032928E-28 4.0000000 4.0000000 19.000000 34.200001 1.76333246E-26 2.68176500E-28 4.0000000 4.0000000 20.000000 36.000000 2.02784245E-26 2.82157692E-28

    Deleted User



    New Member


    Posts:
    New Member


    --
    24 May 2008 11:35 AM
    Although the exact formatting of your data does not show up well on the User Forum display, I bet your data is formatted with a single-space-character delimiter between each column entry. I would also guess that the extra "linefeed" space between blocks of 20 rows consists of a single carriage-return/newline character(s). In any case, the easiest way to read this data would probably be with READ_ASCII and ASCII_TEMPLATE. Here is example code: t = ascii_template(file) ; Just follow the wizard instructions data = read_ascii(file, TEMPLATE=t) ; Note that READ_ASCII ignored the blank lines print, data.FIELD5, FORMAT='(5E)' ; 1.4978014E-029 2.7356384E-029 1.7181958E-029 5.1462106E-029 1.7279938E-028 ; 4.1179305E-028 7.8687864E-028 1.3039510E-027 1.9620194E-027 2.7575307E-027 ; 3.6865342E-027 4.7455114E-027 5.9315888E-027 7.2425058E-027 8.6764970E-027 ; 1.0232169E-026 1.1908398E-026 1.3704266E-026 1.5618996E-026 1.7651924E-026 ; 1.5334880E-029 3.4616346E-029 7.2244852E-029 6.5017481E-029 5.2008733E-029 ; 1.0745366E-028 2.9741127E-028 6.6470506E-028 1.2299125E-027 1.9996441E-027 ; 2.9732718E-027 4.1470876E-027 5.5166214E-027 7.0775060E-027 8.8257573E-027 ; 1.0757963E-026 1.2871366E-026 1.5163762E-026 1.7633325E-026 2.0278425E-026 ; Plot the irst 20-row block of data: x = data.FIELD3[0:19] y1 = data.FIELD5[0:19] y2 = data.FIELD6[0:19] ; Get an appropriate Y-range by getting the min and max of both Y columns minY = min([y1, y2], MAX=maxY) plot, x, y1, YRANGE=[minY, maxY] ; Plot the first dataset oplot, x, y2 ; Overplot the 2nd dataset James Jones
    You are not authorized to post a reply.