This extension allows the user to preview FITS files directly from VSC without having to render them to PNG manually or worry about scaling and plotting settings.
This is what the window looks like when you click a *.fits file in the VSCode explorer sidebar:
Cmd+clicking on the URL that is generated will open the preview in a browser, too!
pyFitsVSC
is a VS Code extension designed to provide previews of FITS files seamlessly within the editor. The extension contributes the pyfitsviewer
custom editor to display FITS file contents.
This extension runs using the pyFitsServer
backend located at https://github.com/GillySpace27/pyFitsServer. You'll need to install that separately and confirm that it is running before this extension will work.
To install and run pyFitsServer
, follow these steps:
-
Clone the repository:
git clone https://github.com/GillySpace27/pyFitsServer.git
-
Navigate to the directory:
cd pyFitsServer
-
Install the dependencies:
pip install -r requirements.txt
-
Run the server:
python server.py
-
Confirm the server is running properly by running tests (from the project root):
pytest
It's recommended to install pyFitsVSC
from a precompiled .vsix
file provided by the developer to avoid complications with compiling from source. This file will be located in the releases on github.
- Download the precompiled
.vsix
file provided by the developer. - Open VS Code.
- Go to Extensions view (
Ctrl+Shift+X
). - Click the three-dot menu (
...
). - Select
Install from VSIX...
. - Browse to and select the downloaded
.vsix
file.
If you need to compile and package pyFitsVSC
from source, follow these steps:
- Clone the repository:
git clone https://github.com/GillySpace27/pyfitsvsc.git
- Navigate to the directory:
cd pyfitsvsc
- Install VSCE:
npm install -g vsce
- Compile TypeScript Code:
npm run compile
- Package the extension:
vsce package
- Install the VSIX file:
- Open VS Code
- Go to Extensions view (
Ctrl+Shift+X
) - Click the three-dot menu (
...
) - Select
Install from VSIX...
- Browse to and select the
.vsix
file created by the previous step.
This extension contributes the following features:
- 'FITS File Preview' as default editor for FITS files
- Being packaged with the server included would be very helpful
- Seems to reduce the resolution of the preview too much
- Some FITS files break the extension, throwing an Assertion Error. I don't know why that happens yet.
- Select the HDU you want to view
- Select the kind of normalization you want to use
- Support for zooming and panning
Initial release of the extension.
Once everything is set up, you can preview FITS files by simply clicking on a .fits
file in the explorer.
Contributions are welcome! Feel free to open issues or submit pull requests.
This project is licensed under the MIT License.