This Python project simulates relativistic space travel, allowing users to explore the effects of traveling close to the speed of light. By configuring various parameters, users can visualize the journey to distant stars, including relativistic effects on time, distance and the apparence of stars.
The basic set-up of the journey is this: we travel along a straightline to the destination star with constant (proper) acceleration
of document.pdf
for a brief introduction and computations involved. A general rule of thumb is for a trip to a star
- Configurable settings via
settings.inifile - Supports Hipparcos; Hipparcos-Tycho or customized star catalogs
- Adjustable parameters for star plotting (size based on magnitudes)
- Output in customizable pixel dimensions
- Option to generate series of images for animation
To run this project, you need Python 3 installed on your machine.
- Clone the repository:
git clone https://github.com/xna24/Space_Travel_Simulator.git
cd Space_Travel_Simulator- Installed required packages
pip install -r requirements.txtalternatively
pip install numpy matplotlib pandas- (Optional) Uncompress the Tycho catalog file
HIP_TYC.csv.gzif usingHIP_TYCinStarCatalogoption insettings.ini. Be sure to putHIP_TYC.csvin the same folder asmain.py. - Configure your settings in the
settings.inifile
You can run the simulation using command line. Here are two main ways to execute the script:
- Using Default Settings:
python3 main.pyThis will use the parameters defined in your settings.ini file.
2. Specifying Trip Ratio:
python3 main.py [trip_ratio]Replace [trip_ratio] with a floating-point number between 0 and 1 (not too close to these two numbers), indicating how much of the trip (in proper time) is complete (e.g., 0.5 for halfway).
The settings.ini file allows you to customize various parameters for the simulation. Below is an explanation of the key sections and their options:
- StarCatalog: specifies which catalog to use. Options include
HIP_TYCfor the Hipparcos-Tycho catalog (combining stars in both catalogs and uses the more precise parameters in Hipparcos when possible, a total of more than$10^6$ stars);HIPfor just the Hipparcos catalog (118,218 stars); orcustomfor a user-defined catalog. - StarCatalogFileName: path to the custom star catalog file, if using a custom catalog
- StarCatalogRAColumn, StarCatalogDEColumn, StarCatalogParallaxColumn, StarCatalogVmagColumn, StarCatalogBVColumn: these parameters define the name of the columns in the star catalog that contain the right ascension (RA), declination (DE), parallax, visual magnitude (Vmag), and B-V color index respectively.
- HIP: the index in the Hipparcos catalog for the destination star. For custom destinations, set this to
0. - Name: the name of the destination star. If left blank and not a custom destination, the HIP number will be printed instead
- RAdeg: right ascension in degree of the destination star (only for custom destination)
- DEdeg: declination in degree of the destination star (only for custom destination)
- parallax: parallax in miliarcseconds (mas) of the destination star (only for custom destination) To convert between parallax and distance: D=1000/parallax where parallax is in mas and distance D is in parsec. 1 parsec = 3.62 ly
- Width, Height: dimension of the output image in pixels. (These are only a guideline as matplotlib adds margins which I did not find a way to control. The default value left in
settings.iniresults in a roughly 1920x1080 image) - LaTeX: set to
yesornoto determin whether to render text using LaTeX for better visual quality. - SizeMultiplier: a multiplier for adjusting the size of stars based on their magnitudes.
- MaxSize: maximum size for the stars in the output image
- SizePowerLaw: star size is determined by this function (const)
$\cdot b^{m_V}$ with$m_V$ the V magnitude, (const) isSizeMultiplierabove and this value is$\log_{10}b$ . The default value is 2.5, so that the area of the star image is proportional to the actual intensity but it might result in too few stars visible. - AzimuthSpan: the azimuthal span of the view, in degrees
- AltitudeSpan: the altitude span of the view, in degrees
- VmagCutoff: the visual magnitude cutoff, stars fainter than this magnitude will not be displayed
- Animated: set to
yesornoto determine if a series of images will be produced for animation. If not animated, a single filesky_map.pngwill be generated. - TripStar, TripEnd, TripStep: these will produce an equally spaced trip-ratios to plot
- FrameFormat: the file extension of frame images
- FrameFileHead, FrameFileTail: the strings to attach before / after frame number, e.g. if we plot 150 frames and set
[Animation]
...
FrameFormat = png
FrameFileHead = frame
FrameFileTail = 20241001The resulting files will be frame_001_20241001.png, frame_002_20241001.png ...
A trip to HIP 38594. Initialize the parameters (parts omitted ... left as default)
[Catalog]
StarCatalog = HIP_TYC
...
[Destination]
HIP = 38594
...
[Sky Map]
Width = 2405
Height = 1377
LaTeX = no
SizeMultiplier = 2
MaxSize = 25
SizePowerLaw = 2.5
AzimuthSpan = 30
AltitudeSpan = 17.1767
VmagCutoff = 16
...In command-line:
> python3 main.py 0.15
Star catalog loaded.
Tot. star count: 1040740
Destination: HIP 38594 HIP 38594
Distance: 63.752 ly
Right Ascension(deg): 118.546
Declination(deg): -25.304
██████████████████████████████████████████████████| 12.01%, 7.61s
██████████████████████████████████████████████████| 24.02%, 11.16s
██████████████████████████████████████████████████| 36.03%, 12.80s
██████████████████████████████████████████████████| 48.04%, 14.88s
██████████████████████████████████████████████████| 60.05%, 25.78s
██████████████████████████████████████████████████| 72.06%, 34.44s
██████████████████████████████████████████████████| 84.07%, 42.00s
██████████████████████████████████████████████████| 96.09%, 48.67s
████████████████