Skip to content

Instantly share code, notes, and snippets.

@nudomarinero
nudomarinero / scale_fits.py
Created June 23, 2020 20:16
Scale FITS image by a factor
"""
Scale data in fits file by a factor
TODO: Inplace mode is not working
"""
import argparse
import os
from pathlib import Path
from astropy.io import fits
import numpy as np
@nudomarinero
nudomarinero / download.bash
Created December 4, 2018 12:07
Download the data from the first SKA science data challenge
#!/bin/bash
# Images
wget https://owncloud.ia2.inaf.it/index.php/s/UDiKqvuscDQViEt/download -O SKAMid_B1_8h.fit
wget https://owncloud.ia2.inaf.it/index.php/s/2nTtGBWpzYJ5Ghr/download -O SKAMid_B1_100h.fit
wget https://owncloud.ia2.inaf.it/index.php/s/DUNztYKW0PSlNH5/download -O SKAMid_B1_1000h.fit
wget https://owncloud.ia2.inaf.it/index.php/s/zEW4JsefeMycR8p/download -O SKAMid_B2_8h.fit
wget https://owncloud.ia2.inaf.it/index.php/s/8K750vop1yjZZXE/download -O SKAMid_B2_100h.fit
wget https://owncloud.ia2.inaf.it/index.php/s/A7XjSZ3n1Kr57TV/download -O SKAMid_B2_1000h.fit
wget https://owncloud.ia2.inaf.it/index.php/s/Uu7yhRjCYknle54/download -O SKAMid_B5_8h.fit
wget https://owncloud.ia2.inaf.it/index.php/s/7lEeXlNvoYFmEfG/download -O SKAMid_B5_100h.fit
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
#!/usr/bin/env python
import sys
import PyQt5
from PyQt5.QtWidgets import QApplication
from PyQt5.QtCore import QThread, QUrl
from PyQt5.QtWebKitWidgets import QWebView
from bottle import Bottle
@nudomarinero
nudomarinero / ref.md
Created October 12, 2016 11:20
Referencias y enlaces adicionales de la charla de la PyConES 2016
@nudomarinero
nudomarinero / macjournal2zim.py
Created February 20, 2016 16:16
Transform MacJournal individual text entries to Zim
from __future__ import print_function
import locale
import datetime
import re
import os
from os.path import isfile, join
import unicodedata
from unidecode import unidecode
@nudomarinero
nudomarinero / read_accel.py
Created November 22, 2015 18:38
Get the acceleration data of a LightBlue Bean using Python
from __future__ import print_function
from bluetooth.ble import GATTRequester
from time import sleep
def get_accel(data):
"""
Get the acceleration values from the data
TODO: Add CRC check
See: http://legacy.punchthrough.com/bean/the-arduino-reference/accelerationreading/
"""
@nudomarinero
nudomarinero / dk_group.py
Last active October 3, 2024 20:12
Command line interface to group raw and normal files in a Digikam album.
#!/usr/bin/env python3
# -*- coding: utf8 -*-
#####
# Copyright (C) 2015 J. Sabater
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
#!/usr/bin/env python
"""
Solutions to the problem proposed in http://gu.com/p/493zk/stw
"""
from itertools import permutations
from decimal import Decimal
def p(x):
"""
Define the problem. Follow the canonical order of operations
@nudomarinero
nudomarinero / gist:92e13f5da0fb799c8797
Last active August 29, 2015 14:20
example of asurv called with pexpect
import pexpect
file_in = "input.dat"
file_out = "output.txt"
c = pexpect.spawn ('asurv')
c.expect('(CARRIAGE RETURN TO CONTINUE)')
c.sendline('')
c.expect('(CARRIAGE RETURN TO CONTINUE)')
c.sendline('')