Metadata-Version: 2.4
Name: Microlensify
Version: 1.0.4
Summary: Microlensing Single Lens Classification – Atousa Kalantari & Somayeh Khakpash
Author-email: Atousa Kalantari <atousakalantari99@gmail.com>
License: MIT
Project-URL: Homepage, https://github.com/Atousa-Kalantari/Microlensify
Project-URL: Repository, https://github.com/Atousa-Kalantari/Microlensify
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Provides-Extra: core
Requires-Dist: numpy>=1.21; extra == "core"
Requires-Dist: pandas; extra == "core"
Requires-Dist: astropy; extra == "core"
Requires-Dist: joblib; extra == "core"
Requires-Dist: tqdm; extra == "core"
Provides-Extra: ml
Requires-Dist: tensorflow>=2.15; extra == "ml"
Requires-Dist: scikit-learn; extra == "ml"
Provides-Extra: full
Requires-Dist: Microlensify[core]; extra == "full"
Requires-Dist: Microlensify[ml]; extra == "full"
Dynamic: license-file

# Microlensify



Microlensify is a Physics-Informed Transformer-Based Variational Autoencode that detects single lens microlensing events in light curves. It works with light curves from any telescope, either via URLs (e.g., MAST FITS files) or your own data files.

Microlensify splits your light curve into chunks and downsamples them to a fixed length for prediction. Predictions are made for each chunk individually and also for the whole light curve.

---

## Installation

```bash
pip install Microlensify
```

## Usage
```bash
Microlensify <input_file> <compute_stats> <n_cores>
```

## Arguments

#### `<input_file>`

- **URL input:** a file containing URLs of light curves and their flux & time column names.  
- **Local files:** a file containing paths to your files and their flux & time column names.

#### `<compute_stats>`

- `yes` — compute flux statistics (min, max, median, std, std/(max-min)) from raw flux.  
- `no` — flux is already normalized (like TESS QLP pipeline flux), so the model uses fixed values from the training set for these statistics.

#### `<n_cores>`

- Number of CPU cores to use for parallel processing.

## Input File Format

- Tab-separated file.

- **Column 1:** time  
- **Column 2:** flux

- **URL input:** list the URLs and the flux/time column names.  
- **Local files:** list file paths and the flux/time column names.

- Example input files are provided in the `Microlensify_Input_Examples` folder.

## Output

All results are saved to `prediction_results.csv` with the following columns:

| Column | Description |
|--------|-------------|
| `Source` | URL or file path of the light curve |
| `Class` | 1 if probability > 0.99, else 0 |
| `Probability` | Model probability of microlensing |
| `Real_4FWHM_days` | Predicted 4FWHM duration (trustworthy if light curve has 940 points over 27.4 days) |
| `Latent_Space` | 20 latent space values from the model (can be used for reconstruction) |
| `Points` | Number of points in the chunk |
| `Chunk_Description` | Description of the chunk used |

---

## Additional Project Codes:
All additional scripts and notebooks used in this work are provided in the `Project_Codes` folder.


## Citation

If you use Microlensify in your research, please cite it appropriately.

---

## Contact

For questions or support, please open an issue or contact atousakalantari99@gmail.com.

