Skip to content

Instantly share code, notes, and snippets.

View Jsevillamol's full-sized avatar

Jaime Sevilla Jsevillamol

View GitHub Profile
# The data config section configures the data loader
data_config:
# file_list_fn: path to a txt file where each line is the absolute path
# to a .h5 file containing information from an event
file_list_fn: /data2/deeplearning/ctlearn/tests/prototype_files_class_balanced.txt
# channels: list of image-like features per image that will be loaded. Supports:
# image_charge: total charge received by pixel during the event
# peak_times: time in seconds when the peak of energy occured
# CAUTION: ctalearn assumes that image_charge is always the first channel
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sat Oct 27 10:22:03 2018
@author: jsevillamol
"""
import yaml, argparse
from contextlib import redirect_stdout
@Jsevillamol
Jsevillamol / ROI_pooling.py
Last active February 11, 2025 20:59
ROI Pooling Layer
import tensorflow as tf
from tensorflow.keras.layers import Layer
class ROIPoolingLayer(Layer):
""" Implements Region Of Interest Max Pooling
for channel-first images and relative bounding box coordinates
# Constructor parameters
pooled_height, pooled_width (int) --
specify height and width of layer outputs
@Jsevillamol
Jsevillamol / CNN_RNN.py
Created October 28, 2018 13:46
CNN RNN model with masking in Keras
# Create model
model = Sequential()
input_shape = (n_tel, img_w, img_h, n_channels)
# mask the inputs that correspond to padding
model.add(Masking(mask_value=0., input_shape=input_shape))
# Add CNN feature extractor
model.add(TimeDistributed(
Conv2D(
@Jsevillamol
Jsevillamol / kelly_criterion.py
Created April 11, 2018 17:03
Public bet between Kyle and Jaime
# -*- coding: utf-8 -*-
"""
Created on Mon Apr 9 15:48:18 2018
@author: jsevillamol
"""
# After the game, I get either $1000 or the value of C in dollars rounded to nearest cent
# You can ask the 3rd party to run the flip_n_times() function as many times as you want within the 2h
# If C overflows during the game, the game ends and I get $1000 dollars
<p>The intuition behind the proof of Lób’s theorem invokes the formalization of the following argument:</p>
<p>Let <script id="MathJax-Element-27" type="math/tex">S</script> stand for the sentence “If <script id="MathJax-Element-28" type="math/tex">S</script> is provable, then I am Santa Claus”.</p>
<p>As it is standard, when trying to prove a If…then theorem we can start by supposing the antecedent and checking that the consequent follows. But if <script id="MathJax-Element-29" type="math/tex">S</script> is provable, then we can chain its proof to an application of modus ponens of <script id="MathJax-Element-30" type="math/tex">S</script> to itself in order to get a proof of the consequent “I am Santa Claus”. If we suppose that finding a proof of a sentence implies that the sentence is true, then “I am Santa Claus” is true.</p>
<p>Thus we have supposed that <script id="MathJax-Element-31" type="math/tex">S</script> is provably true then it follows that “I am Santa Claus”, which is a proof of what <script
@Jsevillamol
Jsevillamol / Prueba ejercicio 9 c
Created February 10, 2016 15:38
Prueba ejercicio 9 c
<p>Sea <script id="MathJax-Element-10368" type="math/tex">f:\mathbb{Z}[t]\to \mathbb{Z}[\sqrt 3]</script>, <script id="MathJax-Element-10369" type="math/tex">p(x)\mapsto p(\sqrt 3)</script>.</p>
<p>Claramente <script id="MathJax-Element-10370" type="math/tex">f</script> es sobreyectiva. Veamos que <script id="MathJax-Element-10371" type="math/tex">ker(f)=(t^2-3)</script>.</p>
<p>Claramente la inclusión <script id="MathJax-Element-10372" type="math/tex">\supset</script> se da.</p>
<p>Ahora, sea <script id="MathJax-Element-10373" type="math/tex">p\in ker f</script>. Por pseudodivisión, <script id="MathJax-Element-10374" type="math/tex">p(t)=(t^2-3)q(x)+r(x)</script>, con <script id="MathJax-Element-10375" type="math/tex">deg(r)<2</script>, y por tanto <script id="MathJax-Element-10376" type="math/tex">p(\sqrt 3)=r(\sqrt 3)=a+b\sqrt 3=0</script>. Como la suma de dos números racionales ha de ser racional, y <script id="MathJax-Element-10377" type="math/tex">\sqrt 3</script> es irracional, no queda más remedio