Re: XDR format files [message #81754] |
Tue, 23 October 2012 06:40  |
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   |
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   |
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   |
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  |
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  |
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
|
|
|