The version1 of hr_ha_auto_flat is writen by Xiaofan wang from old version of Huairou Halpha flat field writen by Yuanyong Deng.
============================================
This version has two new characters:

1) process flat field without input any parameters except the directory which contains flat field files.
Two subroutines were substituted:
center_sobel.pro===>wxf_sunrim1.pro(find solar limb by using all the points near solar limb)
fit_circle.pro=====>wxf_circlefit1.pro(fit solar limb,you can choose the level of convergence)

I strongly suggest you use my two subroutines when you need to know solar radius and solar center coordinates from any solar filtergram of full-disk or partial-disk(contains partial solar limb).

2) Swap_endian depends on hardware and software platform. This means flat field routine maybe not run correctly in your PC and IDL. I introduce a logic condition to decide if the file should be "swap" or not. However, I have not tested much of huairou Halpha data for this logical decision.

How to use hr_ha_auto_flat1.pro?
1) Put all *.pro in the same directory such as "'/home/wxf/Desktop/Runidl/Wxf-pro/flat_field/huairou_flat/'"
2)cd /home/wxf/Desktop/Runidl/Wxf-pro/flat_field/huairou_flat/
3)sswidl  (do not use idlde)
4).r hr_ha_auto_flat1
5) dh='/home/dat/ha_flat_zhmy_for_wxf/0303/'  (dh is the path where you put ha flat field files)
6)  hr_ha_auto_flat1, dh=dh

================================================
Problem in version1
1) if the operation stop somewhere, pleasure check the followint two lines in the routine for your choice.

file = FINDFILE( date+'??????P00A.fit', COUNT = tmp );@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
file = FINDFILE( date+'??????flat.fit', COUNT = tmp );@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

*full.fit and *flat.fit is the old habit giving name to flat field files in Huairou.
I try to free Hurai staff from the labor of "rename flat field files" through computer to decide which one are flat field files (full, partial, dark, not according to file name). But I am not sure everyboy will change this habit.

2) this version is fairly not perfect
"img - limb" in routine make a big trouble. Many images processed by the flat field progam becomes not uniform. I suspect the "limb darkening profile function". Because the kernel of flat field is not created by myself, I could not control very thing.

Halaph in Yunnan obseratory has a CCD problem before. Its machinery shutter moves too slow relative to the exposure time. So starfish appears in their Halpha image. I believe this poblem can be solved throughly by flat field method without changing CCD. But I am still not successful.

The above two examples maybe relate to the "kernel". I mightbe change this kernel someday.
===================================================


