A first cut at an HR (Hertzsprung-Russell) diagram from the tycho-main.dat file is here
Downloaded from CDS at Strasbourg the Hipparcos and Tycho 1 data sets, catalog I 239
From the Readme, determined data layout of tycho_main and created a single table with that layout in MySql database (local version). I set the Tycho identifier (tyc) as the primary key for the table. I also added blank1 and blank2 columns to the table, to handle those empty data in the catalog.
I then imported tycho_main.dat into the MySql table, using MySQL Workbench table import wizard. It took nearly 24 hours to import the million plus rows, but all records were created.
Installed free version of JpGraph on dev machine, and tested with scatter plot examples. I dropped jpgraph into my PEAR folder as it was already on my php.ini include path.
Finally, designed a query to retrieve a lot of the data from the tycho table, using only hipparcos stars.
I am mapping M against B-V, using parallax and V to determine M.
thus using the non-extinction formula based on distance d:
M = m - 5*log(d)+5
M = m - 5*log(1/π)+5
M = m - 5*(log(1)-log(π))+5
M = m + 5*log(π)+5
Catalog has parallax values in milliarcseconds so the formula becomes:
M = m + 5*log(π/1000)+5
M = m + 5*(log(π)-log(1000))+5
M = m + 5*(log(π)-3)+5
M = m + 5*log(π)-15+5
M = m + 5*log(π)-10
The database query used for the diagram is
SELECT b_v_colour, v_mag, prlx FROM tyc_main2 where (prlx >0 and prlx < 1000) and (err_prlx/prlx <= .2) and hip_num > 0
The tycho data has a lot of negative and high error values, but the Hipparcos stars in the catalog seems to have better quality parallax values.
To get the axis for M correct, I had to invert the y-axis, the JpGraph has explicit docs to help with this.
import the hipparcos data into mysql tables, label graph correctly, transfer tables from local to web server, install jpgraph on server, define page to allow custom queries.
and then, do it all in python
Testing will be relative to the HR diagrams at Hipparcos