Skip to content

Instantly share code, notes, and snippets.

View cphyc's full-sized avatar

Corentin Cadiou cphyc

  • Lund University
  • Lund, Sweden
  • X @cphyc
View GitHub Profile
class ColdGasDatasetSeries(DatasetSeries):
def __init__(self, *args, icold=None, **kwa):
kwa['setup_function'] = self.deposit_cells
def deposit_cells(self, ds):
def generate(cell_field, units):
def loc(field, data):
ptype = field.name[0]
cell_pos = np.array(
@cphyc
cphyc / flat_earth.ipynb
Created August 8, 2018 15:58
Flat earth computation
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@cphyc
cphyc / rsync.sh
Last active July 11, 2018 08:31
Synchronize files between the horizon cluster and occigen
#!/usr/bin/bash
# Synchronize RAMSES outputs between two servers
# ==============================================
#
# Backup RAMSES outputs from one server to another one with a progress
# bar. The scripts assumes that the remote server is using slurm as a
# task manager (sbatch, squeue are available). For all running jobs,
# it will synchronize all (but last) outputs, removing the files once
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@cphyc
cphyc / read_sink_data.py
Created June 7, 2018 07:49
Read sink data
#!/usr/bin/env python3
import numpy as np
from cython_fortran_file import FortranFile as FF
import argparse
import pandas as pd
PROPERTIES = 'm x y z vx vy vz jx jy jz dMBHoverdt dMEdoverdt dMsmbh d_avgptr c_avgptr v_avgptr spinx spiny spinz spinmag eps_sink'
parser = argparse.ArgumentParser(
@cphyc
cphyc / read_sink_data.py
Created June 7, 2018 07:49
Read sink data
#!/usr/bin/env python3
import numpy as np
from cython_fortran_file import FortranFile as FF
import argparse
import pandas as pd
PROPERTIES = 'm x y z vx vy vz jx jy jz dMBHoverdt dMEdoverdt dMsmbh d_avgptr c_avgptr v_avgptr spinx spiny spinz spinmag eps_sink'
parser = argparse.ArgumentParser(
@cphyc
cphyc / quick_filter.py
Last active June 6, 2018 15:46
Quick particle filter creation in yt
import yt
import re
def quick_particle_filter(magic, name, ds=None, filtered_type='io'):
'''Quickly generate a particle filter.
Parameters
----------
magic : string
@cphyc
cphyc / compile.sh
Last active April 17, 2018 20:52
Fooling around with MPI communications
mpif90 -O3 -Warray-temporaries -std=f2008 -Wall test_mpi.f90 -o test_mpi
mpirun -np ./test_mpi
@cphyc
cphyc / script-completion
Last active March 8, 2018 14:02
Manage scripts -- it saves the scripts in a database so that you can query it later.
# Complete some frequent commands
_script()
{
local cur prev words cword
_init_completion || return
local IFS=$'\n'
_filedir
@cphyc
cphyc / transfer.sh
Last active February 21, 2018 13:15 — forked from nl5887/transfer.fish
Bash and zsh alias for transfer.sh. Transfers files and directories to transfer.sh.
#
# Defines transfer alias and provides easy command line file and folder sharing.
#
# Authors:
# Remco Verhoef <[email protected]>
#
# Modified by Corentin Cadiou <[email protected]>
#
curl --version 2>&1 > /dev/null