I really did previous long search in the site and I couldn't find any answer that might help me. So I am asking it.
I have the following data set, https://onedrive.live.com/redir?resid=4BEAF2395C9CC198%215058 (this is only a very small part, as a sample ok?), so I tried the following codes ,that i copy from the forum:
$1 = OpenRead[
"C:\\Users\\decicco\\SkyDrive\\Documentos\\ProjetoFinal\\Simbad\\Teste_\
dataMining.txt"];
$2 = ReadList[$1, String];
Close[$1];
Coordenadas Galaticas
Flatten@StringCases[$2,
"Coordinates(Gal,ep=J2000,eq=2000): " ~~ (x :
NumberString ...) ~~ (y : ___ ~~ NumberString ...) ->
ToExpression@{x, y}]
Out[64]= {"307.0804", " +06.8343 ", "307.7283", " 10.4014 "}
Paralaxes erro e qualidade
In[125]:= Flatten@StringCases[$2,
"Parallax: " ~~ (x : ___ ~~ NumberString ...) ~~
"[" ~~ (y : ___ ~~ NumberString ...) ~~ "]" ~~ (z : _?LetterQ ...) ->
ToExpression@{x, y, z}]
Out[125]= {"0.65 ", "0.44", "", "0.95 ", "0.36", ""}
Tipo Espectral
Flatten@StringCases[$2, "Spectral type: " ~~ x : ___ -> x]
Out[108]= {"B0.5Ia C ~ ", "B2.5Ib C ~ "}
Identificadores de catálogos
= Flatten@StringCases[$2,
RegularExpression["(?m)^Identifiers "] ~~ "(" ~~ DigitCharacter ~~
") :" ~~ __ ~~ RegularExpression["(?m)^Notes "]]
Out[146]= {}
So as you can see from the outputs they are not very well done.
What I need:
As you can see in the link, each star is marked like that: Object HR 5027 ---, and the nomenclature HR 5027 is the star that I need the informations, Galactic positions, Parallax, Spectral type and Identifiers. As I can do a list or table like that, or similar:
{{Star 1 , Galactic Coordinate ->......, ->.........;Paralaxes-> ...., error-> ...., quality-> (a letter can be A, B or C);Identifiers-> ....,.....,......, etc. },{Star 2 , Galactic Coordinate ->......, ->.........;Paralaxes-> ...., error-> ...., quality-> (a letter can be A, B or C);Identifiers-> ....,.....,......, etc. }]
I really do not know about associations (<....->....>), and I do not know if is the case here. Is there any good tutorial tha I can learn about associations( as I have always to work with large database with many subitens)?
26/12/2014:
I did some progress: -TAKING THE COORDINATES, TWO FOR EACH STAR
Flatten@StringCases[$2,
"Coordinates(Gal,ep=J2000,eq=2000): " ~~ (x :
NumberString ...) ~~ (y : ___ ~~ NumberString ...) ->
ToExpression@{x, y}]
{"307.0804", " +06.8343 ", "307.7283", " 10.4014 "}
-TAKING PARALAX , ERROR AND QUALITY FOR EACH STARS
Flatten@StringCases[$2,
"Parallax: " ~~ (x : ___ ~~ NumberString ...) ~~
"[" ~~ (y : ___ ~~ NumberString ...) ~~ "]" ~~
RegularExpression["\\s"] ~~ (z : WordCharacter ...) ->
ToExpression@{x, y, z}]
{"0.65 ", "0.44", "A", "0.95 ", "0.36", "A"}
-TAKING THE SPECTRAL TYPES :
Flatten@
StringCases[$2, "Spectral type: " ~~ x : Except["~"] ... -> x]
Out[21]= {"B0.5Ia C ", "B2.5Ib C "}
but, my tries for getting identifiers for each stars did not work:
Flatten@
StringCases[$2,
"Identifiers" ~~ RegularExpression["\\s+"] ~~ "(" ~~
DigitCharacter ... ~~ "):" ~~ WordBoundary ~~
x : LetterCharacter ... ~~ WordBoundary ~~ "Notes" :> x]
Out[121]= {}