Index: /branches/eam_branches/ipp-20150419/Ohana/src/uniphot/src/repair_tycho_setastrom.c
===================================================================
--- /branches/eam_branches/ipp-20150419/Ohana/src/uniphot/src/repair_tycho_setastrom.c	(revision 38282)
+++ /branches/eam_branches/ipp-20150419/Ohana/src/uniphot/src/repair_tycho_setastrom.c	(revision 38283)
@@ -1,9 +1,29 @@
 # include "setastrom.h"
 
-int repair_tycho_setastrom (Catalog *catalog) {
+int repair_tycho_setastrom (Catalog *catalog, SkyRegion *region) {
 
+  double *tychoR, *tychoD;
+  int Ntycho;
+
+  if (!get_tyc_correction (&tychoR, &tychoD, &Ntycho)) {
+    fprintf (stderr, "TYCHO correction not loaded\n");
+    exit (2);
+  }
 
   // first select the subset of objects which lie in this catalog:
+  int Ns = ohana_bisection_double (tychoR, Ntycho, region->Rmin);
 
+  NSUBSET = 100;
+  Nsubset = 0;
+  ALLOCATE (index, int, NSUBSET);
+
+  // scan throught tycho stars to select those in this catalog
+  while ((Ns < Ntycho) && (tychoR[Ns] < region->Rmax)) {
+    if (tychoD[Ns] < region->Dmin) continue;
+    if (tychoD[Ns] > region->Dmax) continue;
+    
+    Ns
+  
+  
   
 
