comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: XDR format files
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: XDR format files [message #81754] Tue, 23 October 2012 06:40 Go to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
wlandsman writes:

> But XDR merely specifies the byte order (big endian but using a minimum of 4 bytes for every data type). It doesn't tell you anything about how the file is organized, or what its contents are. You need to know (or tell us) more about the file to read it.

If you really don't know anything about what is inside an
unformatted data file, then Fervent Prayer is about your
only option.

Cheers,

David



--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thue. ("Perhaps thos speakest truth.")
Re: XDR format files [message #81755 is a reply to message #81754] Tue, 23 October 2012 06:01 Go to previous messageGo to next message
wlandsman is currently offline  wlandsman
Messages: 743
Registered: June 2000
Senior Member
You can open it using the /XDR keyword to OPENU

But XDR merely specifies the byte order (big endian but using a minimum of 4 bytes for every data type). It doesn't tell you anything about how the file is organized, or what its contents are. You need to know (or tell us) more about the file to read it. --Wayne


On Tuesday, October 23, 2012 5:29:37 AM UTC-4, sid wrote:
> On Monday, October 22, 2012 2:49:58 PM UTC+5:30, Helder wrote:
>
>> On Monday, October 22, 2012 10:50:09 AM UTC+2, sid wrote:
>
>>
>
>>> Hi all,
>
>>
>
>>>
>
>>
>
>>> Please let me know how to open a xdr format file.
>
>>
>
>>>
>
>>
>
>>> I dont know the data type and size of the file. So I couldnt use the READU command.
>
>>
>
>>>
>
>>
>
>>> Please do help out in this regard.
>
>>
>
>>>
>
>>
>
>>> thanking you in advance.
>
>>
>
>>>
>
>>
>
>>> sid
>
>>
>
>>
>
>>
>
>> Hi,
>
>>
>
>> as far as I could see, xrd file are ascii files for x-ray diffraction with a header and the last line contains the "0 0 0" reflection.
>
>>
>
>> Then you have at least two options:
>
>>
>
>> 1) you loop until you find the end line or the end of the file. The header lines start with a "[" and the data lines are composed of four numbers: hkl (Miller indices) and intensity. After you define the Line variable as a string (line=''), you may read each line with the command:
>
>>
>
>> readf, Lun, Line
>
>>
>
>> Then check for the "[" character. If present, then it's header, otherwise not.
>
>>
>
>>
>
>>
>
>> 2) The other option is to cound the number of header lines and the number of lines in the file by using the FILE_LINES(FileName) function. Then you can create an array or structure with the correct dimensions. Something like:
>
>>
>
>> Reflex = REPLICATE({h:0,k:0,l:0,Intensity:0.0},FILE_LINES(XRD_FileNam e)-nHeaderLines-1)
>
>>
>
>> And then you fill in the values.
>
>>
>
>>
>
>>
>
>> Once you read a line, you can use the STRSPLIT(Line, /EXTRACT) function to get an array of four elements where the first three are Miller indices and the fourth is an intensity.
>
>>
>
>>
>
>>
>
>> I hope this helps.
>
>>
>
>>
>
>>
>
>> Cheers,
>
>>
>
>> Helder
>
>
>
> Hello sir,
>
> The file which I am having is XDR(external data representation) files. Please let me know how to open this kid of file.
>
> thank you
>
> sid
Re: XDR format files [message #81756 is a reply to message #81755] Tue, 23 October 2012 02:29 Go to previous messageGo to next message
sid is currently offline  sid
Messages: 50
Registered: January 1995
Member
On Monday, October 22, 2012 2:49:58 PM UTC+5:30, Helder wrote:
> On Monday, October 22, 2012 10:50:09 AM UTC+2, sid wrote:
>
>> Hi all,
>
>>
>
>> Please let me know how to open a xdr format file.
>
>>
>
>> I dont know the data type and size of the file. So I couldnt use the READU command.
>
>>
>
>> Please do help out in this regard.
>
>>
>
>> thanking you in advance.
>
>>
>
>> sid
>
>
>
> Hi,
>
> as far as I could see, xrd file are ascii files for x-ray diffraction with a header and the last line contains the "0 0 0" reflection.
>
> Then you have at least two options:
>
> 1) you loop until you find the end line or the end of the file. The header lines start with a "[" and the data lines are composed of four numbers: hkl (Miller indices) and intensity. After you define the Line variable as a string (line=''), you may read each line with the command:
>
> readf, Lun, Line
>
> Then check for the "[" character. If present, then it's header, otherwise not.
>
>
>
> 2) The other option is to cound the number of header lines and the number of lines in the file by using the FILE_LINES(FileName) function. Then you can create an array or structure with the correct dimensions. Something like:
>
> Reflex = REPLICATE({h:0,k:0,l:0,Intensity:0.0},FILE_LINES(XRD_FileNam e)-nHeaderLines-1)
>
> And then you fill in the values.
>
>
>
> Once you read a line, you can use the STRSPLIT(Line, /EXTRACT) function to get an array of four elements where the first three are Miller indices and the fourth is an intensity.
>
>
>
> I hope this helps.
>
>
>
> Cheers,
>
> Helder

Hello sir,
The file which I am having is XDR(external data representation) files. Please let me know how to open this kid of file.
thank you
sid
Re: XDR format files [message #81767 is a reply to message #81756] Mon, 22 October 2012 02:19 Go to previous messageGo to next message
Helder Marchetto is currently offline  Helder Marchetto
Messages: 520
Registered: November 2011
Senior Member
On Monday, October 22, 2012 10:50:09 AM UTC+2, sid wrote:
> Hi all,
>
> Please let me know how to open a xdr format file.
>
> I dont know the data type and size of the file. So I couldnt use the READU command.
>
> Please do help out in this regard.
>
> thanking you in advance.
>
> sid

Hi,
as far as I could see, xrd file are ascii files for x-ray diffraction with a header and the last line contains the "0 0 0" reflection.
Then you have at least two options:
1) you loop until you find the end line or the end of the file. The header lines start with a "[" and the data lines are composed of four numbers: hkl (Miller indices) and intensity. After you define the Line variable as a string (line=''), you may read each line with the command:
readf, Lun, Line
Then check for the "[" character. If present, then it's header, otherwise not.

2) The other option is to cound the number of header lines and the number of lines in the file by using the FILE_LINES(FileName) function. Then you can create an array or structure with the correct dimensions. Something like:
Reflex = REPLICATE({h:0,k:0,l:0,Intensity:0.0},FILE_LINES(XRD_FileNam e)-nHeaderLines-1)
And then you fill in the values.

Once you read a line, you can use the STRSPLIT(Line, /EXTRACT) function to get an array of four elements where the first three are Miller indices and the fourth is an intensity.

I hope this helps.

Cheers,
Helder
Re: XDR format files [message #81838 is a reply to message #81756] Wed, 24 October 2012 01:39 Go to previous message
Helder Marchetto is currently offline  Helder Marchetto
Messages: 520
Registered: November 2011
Senior Member
On Tuesday, October 23, 2012 11:29:37 AM UTC+2, sid wrote:
> On Monday, October 22, 2012 2:49:58 PM UTC+5:30, Helder wrote:
>
>> On Monday, October 22, 2012 10:50:09 AM UTC+2, sid wrote:
>
>>
>
>>> Hi all,
>
>>
>
>>>
>
>>
>
>>> Please let me know how to open a xdr format file.
>
>>
>
>>>
>
>>
>
>>> I dont know the data type and size of the file. So I couldnt use the READU command.
>
>>
>
>>>
>
>>
>
>>> Please do help out in this regard.
>
>>
>
>>>
>
>>
>
>>> thanking you in advance.
>
>>
>
>>>
>
>>
>
>>> sid
>
>>
>
>>
>
>>
>
>> Hi,
>
>>
>
>> as far as I could see, xrd file are ascii files for x-ray diffraction with a header and the last line contains the "0 0 0" reflection.
>
>>
>
>> Then you have at least two options:
>
>>
>
>> 1) you loop until you find the end line or the end of the file. The header lines start with a "[" and the data lines are composed of four numbers: hkl (Miller indices) and intensity. After you define the Line variable as a string (line=''), you may read each line with the command:
>
>>
>
>> readf, Lun, Line
>
>>
>
>> Then check for the "[" character. If present, then it's header, otherwise not.
>
>>
>
>>
>
>>
>
>> 2) The other option is to cound the number of header lines and the number of lines in the file by using the FILE_LINES(FileName) function. Then you can create an array or structure with the correct dimensions. Something like:
>
>>
>
>> Reflex = REPLICATE({h:0,k:0,l:0,Intensity:0.0},FILE_LINES(XRD_FileNam e)-nHeaderLines-1)
>
>>
>
>> And then you fill in the values.
>
>>
>
>>
>
>>
>
>> Once you read a line, you can use the STRSPLIT(Line, /EXTRACT) function to get an array of four elements where the first three are Miller indices and the fourth is an intensity.
>
>>
>
>>
>
>>
>
>> I hope this helps.
>
>>
>
>>
>
>>
>
>> Cheers,
>
>>
>
>> Helder
>
>
>
> Hello sir,
>
> The file which I am having is XDR(external data representation) files. Please let me know how to open this kid of file.
>
> thank you
>
> sid

Ups, I got that one completely wrong... My browser auto-corrects the inputs depending on my usual research field queries!
Anyway, if you want to switch to xrd files, they seem easier to read :-)

Cheers,
h

h
Re: XDR format files [message #81840 is a reply to message #81754] Tue, 23 October 2012 22:24 Go to previous message
Craig Markwardt is currently offline  Craig Markwardt
Messages: 1869
Registered: November 1996
Senior Member
On Tuesday, October 23, 2012 9:40:12 AM UTC-4, David Fanning wrote:
> If you really don't know anything about what is inside an
> unformatted data file, then Fervent Prayer is about your
> only option.

I'm trying to find that in my distribution. Is Fervent Prayer new with IDL 8.2?

Craig
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: IDL New Graphics Axis function: bug or feature?
Next Topic: Random Numbers

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 11:43:38 PDT 2025

Total time taken to generate the page: 0.11274 seconds