==========================================================
README
QD Pixel Yield Analysis Code (in main.py)
==========================================================

1. Overview
----------------------------------------------------------

This Python program analyses BMP images of quantum dot (QD)
pixel patterns and calculates pixel yield statistics based
on intensity threshold counting.


2. Required Python Packages
----------------------------------------------------------

Install the required packages using:

    pip install pillow numpy


3. Input BMP Files
----------------------------------------------------------

The program supports the following image files.

----------------------------------------------------------
BIG PATTERN ANALYSIS
----------------------------------------------------------

    [200x200]big_red.bmp
    [200x200]big_green.bmp
    [200x200]big_blue.bmp

----------------------------------------------------------
2 um PATTERN ANALYSIS
----------------------------------------------------------

    [200x200]2um_red_square.bmp
    [200x200]2um_green_square.bmp
    [200x200]2um_blue_square.bmp

----------------------------------------------------------
SUB-MICRON ANALYSIS
----------------------------------------------------------

    [324x300]sub_micron.bmp


4. Output Files
----------------------------------------------------------

For each analysis, two output files are generated.

Example:

    big_red.txt
    big_red_list.txt

----------------------------------------------------------
Matrix Output File
----------------------------------------------------------

Example:

    big_red.txt

This file stores results in matrix format.

Example:

    1580    1591    1578 ...
    1588    1595    1583 ...

----------------------------------------------------------
List Output File
----------------------------------------------------------

Example:

    big_red_list.txt

This file stores one value per line.

Example:

    1580
    1591
    1578
    ...


5. Analysis Method
----------------------------------------------------------

The program performs the following steps:

(1) Load BMP image

(2) Find maximum intensity value of the selected channel

(3) Calculate threshold value:

        threshold = max_value * 0.5

(4) Divide image into pixel blocks

(5) Count pixels satisfying threshold condition


6. How to Run
----------------------------------------------------------

Edit the main section of the Python script.

Example:

----------------------------------------------------------
BIG pattern analysis
----------------------------------------------------------

    function_big("R")
    function_big("G")
    function_big("B")

----------------------------------------------------------
2 um pattern analysis
----------------------------------------------------------

    function_2um("R")
    function_2um("G")
    function_2um("B")

----------------------------------------------------------
Sub-micron analysis
----------------------------------------------------------

    function_sub()

Then run:

    python your_script_name.py


7. Main Functions
----------------------------------------------------------

----------------------------------------------------------
function_big(color)
----------------------------------------------------------

Analyse BIG pixel patterns.

Arguments:

    "R" = Red
    "G" = Green
    "B" = Blue

Example:

    function_big("R")

----------------------------------------------------------
function_2um(color)
----------------------------------------------------------

Analyse 2 um square pixel patterns.

Arguments:

    "R" = Red
    "G" = Green
    "B" = Blue

Example:

    function_2um("B")

----------------------------------------------------------
function_sub()
----------------------------------------------------------

Analyse sub-micron pixel patterns.