Metadata-Version: 2.4
Name: CosmoSim
Version: 3.0.3
Summary: Simulator of Gravitational Lenses
Author: Hans Georg Schaathun et al
Author-email: Hans Georg Schaathun <georg+github@schaathun.net>
License-Expression: MIT
Project-URL: Homepage, https://github.com/CosmoAI-AES/CosmoSim
Project-URL: Issues, https://github.com/CosmoAI-AES/CosmoSim/issues
Keywords: cosmology,gravitational lensing,simulation
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: C++
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Science/Research
Classifier: Topic :: Scientific/Engineering :: Physics
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.11
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: sympy>=1.13
Requires-Dist: numpy
Requires-Dist: matplotlib
Requires-Dist: opencv-python
Requires-Dist: pandas
Requires-Dist: toml
Requires-Dist: cascadict
Dynamic: author
Dynamic: license-file

---
title: The CosmoAI project
---

# The CosmoSim software

This project provides a simulator for gravitational lensing based on
Chris Clarkson's Roulettes framework.  The code is experimental,
and intended for research, with many loose ends.  If you think it
may be useful, we shall be happy to discuss collaboration and help
you get started.

The core team is
+ [Dr.  Ben David Normann]() - computer science and mathematics
+ [Hans Georg Schaathun]() - cosmology  and mathematics
Documentation is being written at 
[https://cosmoai-aes.github.io/](https://cosmoai-aes.github.io/),
but it still incomplete and fragmented.

## Installation Guide

CosmoSim is set up to build python packages (wheels) that
can be installed with pip.  
```sh
pip install CosmoSim
```

We successfully build CosmoSim for 
Linux/x86_64 and MacOS/arm, for python 3.11 trough 3.14, and 3.14.t
Building on Windows (amd64, python 3.11-3.14) sometimes works,
but currently not.

To build locally from source, you can run (from the root of
the repo),
```
pip install build
python -m build
```
This is highly dependent on the local configuration, and may fail
for a number of reasons.  If it succeeds, the binary file for the
python module appears under src/CosmoSim.

If you can build, pip can also install the package from the working
directory.  Again, from the root of the repo,
```
pip install .
```

For non-standard building, see [BUILD.md](BUILD.md).

## Running the GUI

```sh
python3 -m CosmoSim.GUI
```

The GUI tool is hopefully quite self-explanatory.  
The images shown are the actual source on the left and the distorted (lensed)
image on the right.


## The Command Line Interface (CLI)

An illustrative test set can be generated by the following command.

```sh
mkdir images
python3 -m CosmoSim -CR -Z 400 --csvfile Datasets/debug.csv --directory images
```

This generates a range of images in the newly created images directory.

The flags may be changed; `-C` centres det distorted image in the centre
of the image (being debugged); `-Z` sets the image size; `-R` prints an
axes cross.

Further documentation and examples are found on the 
[web site](https://cosmoai-aes.github.io/),


## Versions

+ The imortant git branches are
    - develop is the current state of the art
    - pypitest is used for final testing with automatic deployment
      to the PyPI test index.
    - master should be the last stable version
+ Releases
    - v-test-* are test releases, used to debug workflows.  Please ignore.
    - see the releases on githun and CHANGELOG.md
+ Prior to v2.0.0 some releases have been tagged, but not registered
as releases in github.
    - v0.1.0, v0.2.0, v1.0.0 are versions made by the u/g students
      Spring 2022.
    - v1.0.1 is cleaned up to be able to build v1.0.0

## Caveats

The simulator makes numerical calculations and there will always
be approximation errors.

1.  The images generated from the same parameters have changed slightly
    between version.  Some changes are because some unfortunate uses of
    integers and single-precision numbers have later been avoided, and some 
    simply because the order of calculation has changed.
1.  The SIS model is implemented in two versions, one rotating
    to have the source on the x-axis and one working directly with
    arbitrary position.  Difference are not perceptible by visual
    comparison, but the difference image shows noticeable difference.


## Contributors

The initial prototype was an undergraduate
[final year project](https://ntnuopen.ntnu.no/ntnu-xmlui/handle/11250/3003634)
by Ingebrigtsen, Remøy, Westbø, Nedreberg, and Austnes (2022).
The software includes both a GUI simulator for interactive experimentation, 
and a command line interface for batch generation of datasets.

+ **Idea and Current Maintainance** Hans Georg Schaathun <hasc@ntnu.no>
+ **Mathematical Models** Ben David Normann
+ **Initial Prototype** Simon Ingebrigtsen, Sondre Westbø Remøy,
  Einar Leite Austnes, and Simon Nedreberg Runde
+ **Other Contributors** Lars Ivar Hatledal, Oda Hjemli



