markdown stringlengths 0 1.02M | code stringlengths 0 832k | output stringlengths 0 1.02M | license stringlengths 3 36 | path stringlengths 6 265 | repo_name stringlengths 6 127 |
|---|---|---|---|---|---|
TrainingTrain in two stages:1. Only the heads. Here we're freezing all the backbone layers and training only the randomly initialized layers (i.e. the ones that we didn't use pre-trained weights from MS COCO). To train only the head layers, pass `layers='heads'` to the `train()` function.2. Fine-tune all layers. For t... | # Train the head branches
# Passing layers="heads" freezes all layers except the head
# layers. You can also pass a regular expression to select
# which layers to train by name pattern.
model.train(dataset_train, dataset_val,
learning_rate=config.LEARNING_RATE,
epochs=1,
layers='h... | _____no_output_____ | MIT | train_t_shirts.ipynb | lumstery/maskrcnn |
Detection | class InferenceConfig(ShapesConfig):
GPU_COUNT = 1
IMAGES_PER_GPU = 1
inference_config = InferenceConfig()
# Recreate the model in inference mode
model = modellib.MaskRCNN(mode="inference",
config=inference_config,
model_dir=MODEL_DIR)
# Get path to saved ... | Processing 1 images
image shape: (128, 128, 3) min: 5.00000 max: 255.00000
molded_images shape: (1, 128, 128, 3) min: -115.70000 max: 151.10000
image_metas shape: (1, 10) min: 0.00000 max: 128.00000
| MIT | train_t_shirts.ipynb | lumstery/maskrcnn |
Evaluation | # Compute VOC-Style mAP @ IoU=0.5
# Running on 10 images. Increase for better accuracy.
image_ids = np.random.choice(dataset_val.image_ids, 10)
APs = []
for image_id in image_ids:
# Load image and ground truth data
image, image_meta, gt_class_id, gt_bbox, gt_mask =\
modellib.load_image_gt(dataset_val, i... | mAP: 1.0
| MIT | train_t_shirts.ipynb | lumstery/maskrcnn |
Ex2 - Filtering and Sorting DataCheck out [Euro 12 Exercises Video Tutorial](https://youtu.be/iqk5d48Qisg) to watch a data scientist go through the exercises This time we are going to pull data directly from the internet. Step 1. Import the necessary libraries | import pandas as pd | _____no_output_____ | BSD-3-Clause | 02_Filtering_&_Sorting/Euro12/Exercises_with_Solutions.ipynb | arscool3/pandas_exercises |
Step 2. Import the dataset from this [address](https://raw.githubusercontent.com/guipsamora/pandas_exercises/master/02_Filtering_%26_Sorting/Euro12/Euro_2012_stats_TEAM.csv). Step 3. Assign it to a variable called euro12. | euro12 = pd.read_csv('https://raw.githubusercontent.com/guipsamora/pandas_exercises/master/02_Filtering_%26_Sorting/Euro12/Euro_2012_stats_TEAM.csv', sep=',')
euro12 | _____no_output_____ | BSD-3-Clause | 02_Filtering_&_Sorting/Euro12/Exercises_with_Solutions.ipynb | arscool3/pandas_exercises |
Step 4. Select only the Goal column. | euro12.Goals | _____no_output_____ | BSD-3-Clause | 02_Filtering_&_Sorting/Euro12/Exercises_with_Solutions.ipynb | arscool3/pandas_exercises |
Step 5. How many team participated in the Euro2012? | euro12.shape[0] | _____no_output_____ | BSD-3-Clause | 02_Filtering_&_Sorting/Euro12/Exercises_with_Solutions.ipynb | arscool3/pandas_exercises |
Step 6. What is the number of columns in the dataset? | euro12.info() | <class 'pandas.core.frame.DataFrame'>
RangeIndex: 16 entries, 0 to 15
Data columns (total 35 columns):
Team 16 non-null object
Goals 16 non-null int64
Shots on target 16 non-null int64
Shots off target 16 non-null int64
Shooting Accuracy ... | BSD-3-Clause | 02_Filtering_&_Sorting/Euro12/Exercises_with_Solutions.ipynb | arscool3/pandas_exercises |
Step 7. View only the columns Team, Yellow Cards and Red Cards and assign them to a dataframe called discipline | # filter only giving the column names
discipline = euro12[['Team', 'Yellow Cards', 'Red Cards']]
discipline | _____no_output_____ | BSD-3-Clause | 02_Filtering_&_Sorting/Euro12/Exercises_with_Solutions.ipynb | arscool3/pandas_exercises |
Step 8. Sort the teams by Red Cards, then to Yellow Cards | discipline.sort_values(['Red Cards', 'Yellow Cards'], ascending = False) | _____no_output_____ | BSD-3-Clause | 02_Filtering_&_Sorting/Euro12/Exercises_with_Solutions.ipynb | arscool3/pandas_exercises |
Step 9. Calculate the mean Yellow Cards given per Team | round(discipline['Yellow Cards'].mean()) | _____no_output_____ | BSD-3-Clause | 02_Filtering_&_Sorting/Euro12/Exercises_with_Solutions.ipynb | arscool3/pandas_exercises |
Step 10. Filter teams that scored more than 6 goals | euro12[euro12.Goals > 6] | _____no_output_____ | BSD-3-Clause | 02_Filtering_&_Sorting/Euro12/Exercises_with_Solutions.ipynb | arscool3/pandas_exercises |
Step 11. Select the teams that start with G | euro12[euro12.Team.str.startswith('G')] | _____no_output_____ | BSD-3-Clause | 02_Filtering_&_Sorting/Euro12/Exercises_with_Solutions.ipynb | arscool3/pandas_exercises |
Step 12. Select the first 7 columns | # use .iloc to slices via the position of the passed integers
# : means all, 0:7 means from 0 to 7
euro12.iloc[: , 0:7] | _____no_output_____ | BSD-3-Clause | 02_Filtering_&_Sorting/Euro12/Exercises_with_Solutions.ipynb | arscool3/pandas_exercises |
Step 13. Select all columns except the last 3. | # use negative to exclude the last 3 columns
euro12.iloc[: , :-3] | _____no_output_____ | BSD-3-Clause | 02_Filtering_&_Sorting/Euro12/Exercises_with_Solutions.ipynb | arscool3/pandas_exercises |
Step 14. Present only the Shooting Accuracy from England, Italy and Russia | # .loc is another way to slice, using the labels of the columns and indexes
euro12.loc[euro12.Team.isin(['England', 'Italy', 'Russia']), ['Team','Shooting Accuracy']] | _____no_output_____ | BSD-3-Clause | 02_Filtering_&_Sorting/Euro12/Exercises_with_Solutions.ipynb | arscool3/pandas_exercises |
Data Processing | df = pd.read_csv('../data/num_data.csv')
dataset = df
dataset.shape
def return_rmse(test,predicted):
rmse = math.sqrt(mean_squared_error(test, predicted))
return rmse
data_size = dataset.shape[0]
train_size=int(data_size * 0.6)
test_size = 100
valid_size = data_size - train_size - test_size
training_set = datas... | _____no_output_____ | MIT | notebooks/LSTM4_pred_plots_12h.ipynb | harryli18/hybrid-rnn-models |
Author : Dipjyoti Das (https://www.linkedin.com/in/dipjyotidas) This script is used to Train classifiers on the dataset and all the classifers are saved as pickle files. The pickled classfiers are used in the sentiment_analysis.py file. Import all the libraries | import nltk
import random
#from nltk.corpus import movie_reviews
from nltk.classify.scikitlearn import SklearnClassifier
import pickle
from sklearn.naive_bayes import MultinomialNB, BernoulliNB
from sklearn.linear_model import LogisticRegression, SGDClassifier
from sklearn.svm import SVC, LinearSVC, NuSVC
from nltk.c... | 10664
Original Naive Bayes Algo accuracy percent: 73.64457831325302
Most Informative Features
wonderful = True pos : neg = 21.8 : 1.0
engrossing = True pos : neg = 19.7 : 1.0
generic = True neg : pos = 16.9 : 1.0
... | MIT | sentiment_analysis/training_classfiers.ipynb | dipjyotidas/NLP |
We can run upto this cell one time. The sentiment analysis module uses the saved pickle objects and it also has the voting classfier and the sentiment function. The module saved is sentiment_analysis.py After importing the sentiment analysis module : We can use this to check if any sentiment is positive or negative w... | import sentiment_analysis as s
# referencing the sentiment function of the sentiment_analysis.py script
# Example - Pass through our own positive review
print(s.sentiment("This movie was awesome! The story was great and performances were amazing, I really liked it!"))
# Example - Pass through a negative review
prin... | _____no_output_____ | MIT | sentiment_analysis/training_classfiers.ipynb | dipjyotidas/NLP |
Physically Based Rendering {pbr_example}==========================VTK 9 introduced Physically Based Rendering (PBR) and we have exposedthat functionality in PyVista. Read the [blog aboutPBR](https://blog.kitware.com/vtk-pbr/) for more details.PBR is only supported for `pyvista.PolyData`{.interpreted-textrole="class"} a... | import pyvista as pv
from pyvista import examples
# Load the statue mesh
mesh = examples.download_nefertiti()
mesh.rotate_x(-90.) # rotate to orient with the skybox
# Download skybox
cubemap = examples.download_sky_box_cube_map() | _____no_output_____ | MIT | locale/examples/02-plot/pbr.ipynb | tkoyama010/pyvista-doc-translations |
Let\'s render the mesh with a base color of \"linen\" to give it a metallooking finish. | p = pv.Plotter()
p.add_actor(cubemap.to_skybox())
p.set_environment_texture(cubemap) # For reflecting the environment off the mesh
p.add_mesh(mesh, color='linen',
pbr=True, metallic=0.8, roughness=0.1,
diffuse=1)
# Define a nice camera perspective
cpos = [(-313.40, 66.09, 1000.61),
(0.0,... | _____no_output_____ | MIT | locale/examples/02-plot/pbr.ipynb | tkoyama010/pyvista-doc-translations |
Show the variation of the metallic and roughness parameters.Plot with metallic increasing from left to right and roughnessincreasing from bottom to top. | colors = ['red', 'teal', 'black', 'orange', 'silver']
p = pv.Plotter()
p.set_environment_texture(cubemap)
for i in range(5):
for j in range(6):
sphere = pv.Sphere(radius=0.5, center=(0.0, 4 - i, j))
p.add_mesh(sphere, color=colors[i],
pbr=True, metallic=i/4, roughness=j/5)
p.vi... | _____no_output_____ | MIT | locale/examples/02-plot/pbr.ipynb | tkoyama010/pyvista-doc-translations |
Combine custom lighting and physically based rendering. | # download louis model
mesh = examples.download_louis_louvre()
mesh.rotate_z(140)
plotter = pv.Plotter(lighting=None)
plotter.set_background('black')
plotter.add_mesh(mesh, color='linen', pbr=True,
metallic=0.5, roughness=0.5, diffuse=1)
# setup lighting
light = pv.Light((-2, 2, 0), (0, 0, 0), 'whi... | _____no_output_____ | MIT | locale/examples/02-plot/pbr.ipynb | tkoyama010/pyvista-doc-translations |
Becquerel OverviewThis notebook demonstrates some of the main features and functionalities of `becquerel`:1. [`bq.Spectrum`](1.-bq.Spectrum) - [Constructor](1.1-From-scratch) - [Energy Calibration Models](1.2-Energy-Calibration-Models) - [File IO](1.3-From-File) - [Backrgound Subtraction](1.4-Background-Subtractio... | %pylab inline
import pandas as pd
import becquerel as bq
from pprint import pprint
np.random.seed(0) | Populating the interactive namespace from numpy and matplotlib
| BSD-3-Clause-LBNL | examples/overview.ipynb | werthm/becquerel |
1. `bq.Spectrum`The core class in `bq` is `Spectrum`. This class contains a variety of tools for handling **single spectrum** data.Further details can be found in the [spectrum notebook](./spectrum.ipynb) and [spectrum plotting notebook](./plotting.ipynb). | bq.Spectrum? | _____no_output_____ | BSD-3-Clause-LBNL | examples/overview.ipynb | werthm/becquerel |
1.1 From scratch | c, _ = np.histogram(np.random.poisson(50, 1000), bins=np.arange(101))
spec = bq.Spectrum(counts=c, livetime=60.)
spec
spec.plot(xmode='channels');
try:
spec.plot(xmode='energy')
except bq.PlottingError as e:
print('ERROR:', e)
plt.close('all') | ERROR: Spectrum is not calibrated, however x axis was requested as energy
| BSD-3-Clause-LBNL | examples/overview.ipynb | werthm/becquerel |
1.2 Energy Calibration ModelsAll calibrations are instances of `Calibration`, which stores an arbitrary scalar function and its relevant parameters.Further details can be found in the [energycal notebook](./energycal.ipynb). | chlist = (40, 80)
kevlist = (661.7, 1460.83)
cal = bq.Calibration.from_points("p[0] + p[1] * x", chlist, kevlist, rng=(-1e3, 1e5))
print(cal.params)
spec.apply_calibration(cal)
print(spec)
spec.plot(xmode='keV');
# New spec
c, _ = np.histogram(np.random.poisson(50, 1000), bins=np.arange(101))
spec2 = bq.Spectrum(counts... | _____no_output_____ | BSD-3-Clause-LBNL | examples/overview.ipynb | werthm/becquerel |
1.3 From File`becquerel` currently provides parsers for:- `SPE`- `SPC`- `CNF` | spec = bq.Spectrum.from_file('../tests/samples/1110C NAA cave pottery.Spe')
spec
spec.is_calibrated
spec.plot(yscale='log', linewidth=0.5, ymode='counts');
%%capture
spec = bq.Spectrum.from_file('../tests/samples/01122014152731-GT01122014182338-GA37.4963000N-GO122.4633000W.cnf')
spec
%%capture
spec = bq.Spectrum.from_f... | _____no_output_____ | BSD-3-Clause-LBNL | examples/overview.ipynb | werthm/becquerel |
1.4 Background Subtraction | spec = bq.Spectrum.from_file('../tests/samples/1110C NAA cave pottery.Spe')
print(spec)
bkg = bq.Spectrum.from_file('../tests/samples/1110C NAA cave background May 2017.spe')
print(bkg)
bkgsub = spec - bkg
print('Total pottery countrate: {:6.3f}'.format(np.sum(spec.cps)))
print('Total background countrate: {:6.3f}'.... | _____no_output_____ | BSD-3-Clause-LBNL | examples/overview.ipynb | werthm/becquerel |
1.5 Rebinning- deterministic (interpolation): `interpolation`- stochastic (convert to listmode): `listmode`Further details can be found in the [rebinning notebook](./rebinning.ipynb). | spec = bq.Spectrum.from_file('../tests/samples/1110C NAA cave pottery.Spe')
bkg = bq.Spectrum.from_file('../tests/samples/1110C NAA cave background May 2017.spe')
bkg_rebin = bkg.rebin(np.linspace(0., 3000., 16000))
try:
bkgsub = spec - bkg_rebin
except bq.SpectrumError as e:
print('ERROR:', e)
spec_rebin = spe... | becquerel/core/spectrum.py:815: SpectrumWarning: Subtraction of counts-based specta, spectra have been converted to CPS
warnings.warn(
| BSD-3-Clause-LBNL | examples/overview.ipynb | werthm/becquerel |
1.6 ScalingMultiplication or division will be applied to the data of the spectrum. The following decimates a spectrum by dividing by 10: | spec = bq.Spectrum.from_file('../tests/samples/1110C NAA cave background May 2017.spe')
spec_div = spec / 10
print(spec_div) | SpeFile: Reading file ../tests/samples/1110C NAA cave background May 2017.spe
becquerel.Spectrum
start_time: None
stop_time: None
realtime: None
livetime: None
is_calibrated: True
num_bins: 16384
gross_counts: (1.0529+/-0.0010)e+05
gross_cps: None
f... | BSD-3-Clause-LBNL | examples/overview.ipynb | werthm/becquerel |
One might however want to decimate a spectrum in a way consistent with Poisson statistics. For that there is the `downsample` method: | spec_downsample = spec.downsample(10, handle_livetime='reduce')
print(spec_downsample)
ax = spec_div.plot(label='div', ymode='counts', yscale='log')
spec_downsample.plot(ax=ax, label='downsample', ymode='counts')
ax.legend()
ax.set_xlim(600, 620)
ax.set_ylim(1.3, 5e1); | becquerel.Spectrum
start_time: None
stop_time: None
realtime: None
livetime: 43781.7
is_calibrated: True
num_bins: 16384
gross_counts: (1.0484+/-0.0033)e+05
gross_cps: 2.395+/-0.008
filename: None
| BSD-3-Clause-LBNL | examples/overview.ipynb | werthm/becquerel |
1.7 Automatic CalibrationThere are utilities in Becquerel for automatically finding peaks in a raw spectrum and matching them to a list of energies as a first pass at a full calibration.Further details can be found in the [autocal notebook](./autocal.ipynb).Let's load an uncalibrated sodium iodide spectrum that has Co... | spec = bq.Spectrum.from_file('../tests/samples/digibase_5min_30_1.spe')
fig, ax = plt.subplots(1, figsize=(12, 6))
spec.plot(ax=ax, linewidth=0.5, xmode='channels', yscale='log')
plt.xlim(0, len(spec));
# filter the spectrum
kernel = bq.GaussianPeakFilter(400, 20, 3)
finder = bq.PeakFinder(spec, kernel)
finder.find_pea... | found best gain: 6.371703 keV/channel
| BSD-3-Clause-LBNL | examples/overview.ipynb | werthm/becquerel |
2. Nuclear Data 2.1 `bq.Element` | e1 = bq.Element('Cs')
e2 = bq.Element(55)
e3 = bq.Element('55')
print(e1, e2, e3)
print(e1 == e2 == e3)
print('{:%n(%s) Z=%z}'.format(e1))
pprint(e1.__dict__, width=10) | Cesium(Cs) Z=55 Cesium(Cs) Z=55 Cesium(Cs) Z=55
True
Cesium(Cs) Z=55
{'Z': 55,
'atomic_mass': 132.91,
'name': 'Cesium',
'symbol': 'Cs'}
| BSD-3-Clause-LBNL | examples/overview.ipynb | werthm/becquerel |
2.2 `bq.Isotope`Further examples of `Isotope` and `IsotopeQuantity` can be found in the [isotopes notebook](./isotopes.ipynb). | i1 = bq.Isotope('Cs-137')
i2 = bq.Isotope('137CS')
i3 = bq.Isotope('Cs', 137)
i4 = bq.Isotope('Cesium-137')
i5 = bq.Isotope('137CAESIUM')
print(i1, i2, i3, i4, i5)
print(i1 == i2 == i3 == i4 == i5) | Cs-137 Cs-137 Cs-137 Cs-137 Cs-137
True
| BSD-3-Clause-LBNL | examples/overview.ipynb | werthm/becquerel |
Isotope names and properties | iso = bq.Isotope('Tc-99m')
print(iso)
print('{:%n(%s)-%a%m Z=%z}'.format(iso))
pprint(iso.__dict__)
print('half-life: {:.2f} hr'.format(iso.half_life / 3600)) | Tc-99m
Technetium(Tc)-99m Z=43
{'A': 99,
'M': 1,
'N': 56,
'Z': 43,
'atomic_mass': 98,
'm': 'm',
'name': 'Technetium',
'symbol': 'Tc'}
half-life: 6.01 hr
| BSD-3-Clause-LBNL | examples/overview.ipynb | werthm/becquerel |
More isotope properties such as half-life, stability, and natural abundance are available: | for a in range(39, 42):
iso = bq.Isotope('Potassium', a)
print('')
print('Isotope: {}'.format(iso))
print(' Spin-parity: {}'.format(iso.j_pi))
if iso.abundance is not None:
print(' Abundance: {:.2f}%'.format(iso.abundance))
print(' Stable? {}'.format(iso.is_stable))
i... |
Isotope: K-39
Spin-parity: 3/2+
Abundance: 93.26+/-0.00%
Stable? True
Isotope: K-40
Spin-parity: 4-
Abundance: 0.01+/-0.00%
Stable? False
Half-life: 1.248e+09 years
Decay modes: (['EC', 'B-'], [10.72, 89.28])
Isotope: K-41
Spin-parity: 3/2+
Abundance: 6.73+/-... | BSD-3-Clause-LBNL | examples/overview.ipynb | werthm/becquerel |
2.3 `bq.IsotopeQuantity` Source activity on a given dateHere's a check source activity on today's date: | ba133_chk = bq.IsotopeQuantity('ba133', date='2013-05-01', uci=10.02)
ba133_chk.uci_now() | _____no_output_____ | BSD-3-Clause-LBNL | examples/overview.ipynb | werthm/becquerel |
Or for another date: | ba133_chk.uci_at('2018-02-16') | _____no_output_____ | BSD-3-Clause-LBNL | examples/overview.ipynb | werthm/becquerel |
2.4 `bq.materials`Access the [NIST X-ray mass attenuation coefficients database](https://www.nist.gov/pml/x-ray-mass-attenuation-coefficients) for [elements](https://physics.nist.gov/PhysRefData/XrayMassCoef/tab1.html) and [compounds](https://physics.nist.gov/PhysRefData/XrayMassCoef/tab2.html) and also data from the ... | mat_data = bq.materials.fetch_materials()
pprint(list(mat_data.keys()))
pprint(mat_data['Air, Dry (near sea level)'], indent=4) | { 'density': 0.001205,
'formula': '-',
'source': 'NIST '
'(http://physics.nist.gov/PhysRefData/XrayMassCoef/tab2.html)',
'weight_fractions': [ 'C 0.000124',
'N 0.755268',
'O 0.231781',
'Ar 0.012827']}
| BSD-3-Clause-LBNL | examples/overview.ipynb | werthm/becquerel |
2.5 `bq.nndc`Tools to query the [National Nuclear Data Center databases](https://www.nndc.bnl.gov/nudat2/) to obtain decay radiation, branching ratios, and many other types of nuclear data.Further details and examples can be found in the [nndc notebook](./nndc.ipynb) and the [nndc_chart_of_nuclides notebook](./nndc_ch... | rad = bq.nndc.fetch_decay_radiation(nuc='Co-60', type='Gamma', i_range=(5, None))
cols = ['Z', 'Element', 'A', 'Decay Mode', 'Radiation', 'Radiation Energy (keV)',
'Radiation Intensity (%)', 'Energy Level (MeV)']
display(rad[cols])
# NNDC nuclear wallet cards are used by bq.Isotope but can be accessed directly ... | _____no_output_____ | BSD-3-Clause-LBNL | examples/overview.ipynb | werthm/becquerel |
2.6 `bq.xcom`The [NIST XCOM photon cross sections database](https://www.nist.gov/pml/xcom-photon-cross-sections-database) can be [queried](https://physics.nist.gov/PhysRefData/Xcom/html/xcom1.html) in `becquerel`.Further details can be found in the [xcom notebook](./xcom.ipynb)For example, here is how to access the cr... | # query XCOM by element symbol
data = bq.xcom.fetch_xcom_data('Pb', e_range_kev=[10., 3000.])
plt.figure()
for field in ['total_w_coh', 'total_wo_coh', 'coherent', 'incoherent',
'photoelec', 'pair_nuc', 'pair_elec']:
plt.semilogy(data.energy, data[field], label=field)
plt.xlim(0, 3000)
plt.xlabel('En... | _____no_output_____ | BSD-3-Clause-LBNL | examples/overview.ipynb | werthm/becquerel |
1. set_index 2. reset_index | import pandas as pd
df = pd.read_csv("C:/Users/deepusuresh/Documents/Data Science/08. Data Sets/Pandas.csv")
df
df.index
df.set_index('day') # df.set_index('day',inplace=True)
df
df.reset_index(inplace=True)
df
df.set_index('event',inplace=True)
df | _____no_output_____ | CNRI-Python | 7_Change_Index and Column_Header/2_Set_Index.ipynb | sureshmecad/Pandas |
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | #url = "C:/Users/deepusuresh/Documents/Data Science/01. Python/3. PANDAS/1. Data Frame"
df = pd.read_csv('C:/Users/deepusuresh/Documents/Data Science/01. Python/3. PANDAS/1. Data Frame/IMDB-Movie-Data.csv')
df.head(3)
df = pd.read_csv("C:/Users/deepusuresh/Documents/Data Science/01. Python/3. PANDAS/1. Data Frame/IMDB... | _____no_output_____ | CNRI-Python | 7_Change_Index and Column_Header/2_Set_Index.ipynb | sureshmecad/Pandas |
We're loading this dataset from a CSV and designating the movie titles to be our index. | df = pd.read_csv("C:/Users/deepusuresh/Documents/Data Science/01. Python/3. PANDAS/1. Data Frame/IMDB-Movie-Data.csv", index_col="Title")
df.head(3) | _____no_output_____ | CNRI-Python | 7_Change_Index and Column_Header/2_Set_Index.ipynb | sureshmecad/Pandas |
 Visualizing Big Data in R (A... | rlib <- "~/lib"
dir.create(rlib)
.libPaths(rlib)
library(remotes)
install_version("hexbin", "1.28.1", lib = rlib, upgrade = "never")
install_version("fst", "0.9.2", lib = rlib, upgrade = "never")
install_version("ggcorrplot", "0.1.3", lib = rlib, upgrade = "never")
install_version("trelliscopejs", "0.2.5", lib = rlib, ... | _____no_output_____ | MIT | notebooks/visualizing-big-data-in-r-codealong-answers.ipynb | marsanul/visualizacionbigdata |
Chapter 1: Too many points - point size, transparency, transformation Here, you'll look at the LA home prices dataset to explore ways of reducing overplotting. Learning objectives- Understands that one cause of overplotting in scatter plots is simply that there are too many points.- Can apply point size adjustments, ... | # Load tibble, ggplot2, and a CSV reader
library(readr) # or library(data.table)
library(tibble)
library(ggplot2) | _____no_output_____ | MIT | notebooks/visualizing-big-data-in-r-codealong-answers.ipynb | marsanul/visualizacionbigdata |
Exploring the datasetThe dataset is here. Run this cell! | data_file <- "https://raw.githubusercontent.com/datacamp/Visualizing-Big-Data-in-R-live-training/master/data/LAhomes.csv" | _____no_output_____ | MIT | notebooks/visualizing-big-data-in-r-codealong-answers.ipynb | marsanul/visualizacionbigdata |
Read in the dataset from `data_file`, assigning the result to `la_homes`. Explore it (using whichever functions you like). | # Read data_file from CSV
la_homes <- read_csv(data_file)
# Explore it
glimpse(la_homes) | _____no_output_____ | MIT | notebooks/visualizing-big-data-in-r-codealong-answers.ipynb | marsanul/visualizacionbigdata |
- `price` is the sale price of the home, in USD.- `sqft` is the area of the home in square feet (about 0.1 square meters).Using `la_homes`, draw a scatter plot of `price` versus `sqft`. | # Using la_homes, plot price vs. sqft with point layer
ggplot(la_homes, aes(sqft, price)) +
geom_point() | _____no_output_____ | MIT | notebooks/visualizing-big-data-in-r-codealong-answers.ipynb | marsanul/visualizacionbigdata |
Changing point sizeNotice that points in the plot are heavily overplotted in the bottom left corner.Redraw the basic scatter plot, changing the point size to `0.5`. | # Draw same scatter plot, with size 0.5
ggplot(la_homes, aes(sqft, price)) +
geom_point(size = 0.5) | _____no_output_____ | MIT | notebooks/visualizing-big-data-in-r-codealong-answers.ipynb | marsanul/visualizacionbigdata |
Redraw the basic scatter plot, changing the point shape to be "pixel points". | # Draw same scatter plot, with pixel shape
ggplot(la_homes, aes(sqft, price)) +
geom_point(shape = ".") | _____no_output_____ | MIT | notebooks/visualizing-big-data-in-r-codealong-answers.ipynb | marsanul/visualizacionbigdata |
Using transparencyRedraw the basic scatter plot, changing the transparency level of points to `0.25`. Set a white background by using ggplot2's black and white theme. | # Draw same scatter plot, with transparency 0.25 and black & white theme
ggplot(la_homes, aes(sqft, price)) +
geom_point(alpha = 0.25) +
theme_bw() | _____no_output_____ | MIT | notebooks/visualizing-big-data-in-r-codealong-answers.ipynb | marsanul/visualizacionbigdata |
Transform the axesMost of the plots are stuck in the bottom-left corner. Transform the x and y axes to spread points more evenly throughout.Redraw the basic scatter plot, applying a log10 transformation to the x and y scales. | # Draw same scatter plot, with log-log scales
ggplot(la_homes, aes(sqft, price)) +
geom_point() +
scale_x_log10() +
scale_y_log10() | _____no_output_____ | MIT | notebooks/visualizing-big-data-in-r-codealong-answers.ipynb | marsanul/visualizacionbigdata |
Redraw the scatter plot using all three tricks at once.- Set the point size to `0.5`.- Set the point transparency to `0.25`.- Using log10 transformations for the x and y scales.- Use the black and white theme. | # Draw same scatter plot, with all 3 tricks
ggplot(la_homes, aes(sqft, price)) +
geom_point(size = 0.5, alpha = 0.25) +
scale_x_log10() +
scale_y_log10() +
theme_bw() | _____no_output_____ | MIT | notebooks/visualizing-big-data-in-r-codealong-answers.ipynb | marsanul/visualizacionbigdata |
Hex plotsDraw a hex plot of `price` versus `sqft`. | # Using la_homes, plot price vs. sqft with hex layer
ggplot(la_homes, aes(sqft, price)) +
geom_hex() | _____no_output_____ | MIT | notebooks/visualizing-big-data-in-r-codealong-answers.ipynb | marsanul/visualizacionbigdata |
Redraw the hex plot, applying log10 transformations to the x and y scales. | # Draw same hex plot, with log-log scales
ggplot(la_homes, aes(sqft, price)) +
geom_hex() +
scale_x_log10() +
scale_y_log10() | _____no_output_____ | MIT | notebooks/visualizing-big-data-in-r-codealong-answers.ipynb | marsanul/visualizacionbigdata |
Which statement about the trend is true?- [ ] Price increases roughly linearly with area.- [ ] Price increases roughly linearly with log area.- [ ] Log price increases roughly linearly with area.- [x] Log price increases roughly linearly with log area. Which statement about the overplotting is true?- [ ] The majority o... | library(readr)
library(dplyr)
library(ggplot2) | _____no_output_____ | MIT | notebooks/visualizing-big-data-in-r-codealong-answers.ipynb | marsanul/visualizacionbigdata |
Importing and exploring the dataThe dataset is here. Run this chunk! | data_file <- "https://raw.githubusercontent.com/datacamp/Visualizing-Big-Data-in-R-live-training/master/data/LAhomes.csv" | _____no_output_____ | MIT | notebooks/visualizing-big-data-in-r-codealong-answers.ipynb | marsanul/visualizacionbigdata |
Import the LA homes dataset from `data_file`, assigning to `la_homes`. | # Import data_file
la_homes <- read_csv(data_file) | _____no_output_____ | MIT | notebooks/visualizing-big-data-in-r-codealong-answers.ipynb | marsanul/visualizacionbigdata |
- `bed` contains the number of bedrooms in the home.Take a look at the distinct values in `bed` using `distinct()`. | # Look at the distinct values of the bed column
la_homes %>%
distinct(bed) | _____no_output_____ | MIT | notebooks/visualizing-big-data-in-r-codealong-answers.ipynb | marsanul/visualizacionbigdata |
Notice that the number of bedrooms is always an integer and sometimes zero. Scatter plots of price vs. bedroomsUsing `la_homes`, draw a scatter plot of `price` versus `bed`. | # Using la_homes, plot price vs. bed with a point layer
ggplot(la_homes, aes(bed, price)) +
geom_point() | _____no_output_____ | MIT | notebooks/visualizing-big-data-in-r-codealong-answers.ipynb | marsanul/visualizacionbigdata |
Draw the same plot again, this time jittering the points along the x-axis.- Use a maximum jitter distance of `0.4` in the x direction.- Don't jitter in the y direction. | # Draw the previous plot but jitter points with width 0.4
ggplot(la_homes, aes(bed, price)) +
geom_jitter(width = 0.4) | _____no_output_____ | MIT | notebooks/visualizing-big-data-in-r-codealong-answers.ipynb | marsanul/visualizacionbigdata |
Most of the points are near the bottom of the plot.Draw the same jittered plot again, this time using a log10 transformation on the y-scale. | # Draw the previous plot but use a log y-axis
ggplot(la_homes, aes(bed, price)) +
geom_jitter(width = 0.4) +
scale_y_log10() | _____no_output_____ | MIT | notebooks/visualizing-big-data-in-r-codealong-answers.ipynb | marsanul/visualizacionbigdata |
Scatter plots of bathrooms vs. bedrooms- `bath` contains the number of bathrooms in the home.Take a look at the distinct values in `bath` using `distinct()`. | # Look at the distinct values of the bath column
la_homes %>%
distinct(bath) | _____no_output_____ | MIT | notebooks/visualizing-big-data-in-r-codealong-answers.ipynb | marsanul/visualizacionbigdata |
Notice that the dataset includes half and quarter bathrooms (whatever they are).Draw a scatter plot of `bath` versus `bed`. | # Using la_homes, plot bath vs. bed with a point layer
ggplot(la_homes, aes(bed, bath)) +
geom_point() | _____no_output_____ | MIT | notebooks/visualizing-big-data-in-r-codealong-answers.ipynb | marsanul/visualizacionbigdata |
Draw the same plot again, this time jittering the points.- Use a maximum jitter distance of `0.4` in the x direction.- Use a maximum jitter distance of `0.05` in the y direction. | # Using la_homes, plot price vs. bed with a jittered point layer
ggplot(la_homes, aes(bed, bath)) +
geom_jitter(width = 0.4, height = 0.05) | _____no_output_____ | MIT | notebooks/visualizing-big-data-in-r-codealong-answers.ipynb | marsanul/visualizacionbigdata |
Filtering and transformationThere are three homes with 10 or more bedrooms. These constitute outliers, and for the purpose of drawing nicer plots, we're going to remove them.Filter `la_homes` for rows where `bed` is less than `10`, assigning to `la_homes10`. Count the number of rows you removed to check you've done it... | # Filter for bed less than 10
la_homes10 <- la_homes %>%
filter(bed < 10)
# Calculate the number of outliers you removed
nrow(la_homes) - nrow(la_homes10) | _____no_output_____ | MIT | notebooks/visualizing-big-data-in-r-codealong-answers.ipynb | marsanul/visualizacionbigdata |
Draw the same jittered scatter plot again, this time using the filtered dataset (`la_homes10`). As before, use a jitter width of `0.4` and a jitter height of `0.05`. | # Draw the previous plot, but with the la_homes10 dataset
ggplot(la_homes10, aes(bed, bath)) +
geom_jitter(width = 0.4, height = 0.05) | _____no_output_____ | MIT | notebooks/visualizing-big-data-in-r-codealong-answers.ipynb | marsanul/visualizacionbigdata |
Most of the points are towards the bottom left of the plot.Draw the same jittered scatter plot again, this time applying square-root transformations to the x and y scales. | # Draw the previous plot but with sqrt-sqrt scales
ggplot(la_homes10, aes(bed, bath)) +
geom_jitter(width = 0.4, height = 0.05) +
scale_x_sqrt() +
scale_y_sqrt() | _____no_output_____ | MIT | notebooks/visualizing-big-data-in-r-codealong-answers.ipynb | marsanul/visualizacionbigdata |
Refine the plot one more time, by making the points transparent.Draw the previous plot again, setting the transparency level to 0.25 (and using a black and white theme). | ggplot(la_homes10, aes(bed, bath)) +
geom_jitter(width = 0.4, height = 0.05, alpha = 0.25) +
scale_x_sqrt() +
scale_y_sqrt() +
theme_bw() | _____no_output_____ | MIT | notebooks/visualizing-big-data-in-r-codealong-answers.ipynb | marsanul/visualizacionbigdata |
Chapter 3: Too many variables - correlation heatmaps Here you'll look at a dataset on Scotch whisky preferences. Learning objectives- Can draw a correlation heatmap.- Can use hierarchical clustering to order cells in a correlation heatmap.- Can adjust the color scale in a correlation heatmap.- Can interpret a correlat... | library(fst)
library(tibble)
library(ggplot2)
library(ggcorrplot) | _____no_output_____ | MIT | notebooks/visualizing-big-data-in-r-codealong-answers.ipynb | marsanul/visualizacionbigdata |
Get the datasetThe dataset is a modified version of `bayesm::Scotch`. - See https://www.rdocumentation.org/packages/bayesm/topics/Scotch for details.- Each observation is a survey response indicating the brands of Scotch consumed in the last year. Run this to download the data file. | download.file(
"https://github.com/datacamp/Visualizing-Big-Data-in-R-live-training/raw/master/data/scotch.fst",
"scotch.fst"
) | _____no_output_____ | MIT | notebooks/visualizing-big-data-in-r-codealong-answers.ipynb | marsanul/visualizacionbigdata |
Import the dataset from `scotch.fst` and assign to `scotch`. | # Import from scotch.fst
scotch <- read_fst("scotch.fst")
# Explore the dataset, however you wish
glimpse(scotch) | _____no_output_____ | MIT | notebooks/visualizing-big-data-in-r-codealong-answers.ipynb | marsanul/visualizacionbigdata |
Draw a basic correlation heatmapCalculate the correlation matrix for `scotch`, assigning to `correl`. | # Calculate the correlation matrix
correl <- cor(scotch) | _____no_output_____ | MIT | notebooks/visualizing-big-data-in-r-codealong-answers.ipynb | marsanul/visualizacionbigdata |
Draw a correlation heatmap of it (no customization). | # Draw a correlation heatmap
ggcorrplot(correl) | _____no_output_____ | MIT | notebooks/visualizing-big-data-in-r-codealong-answers.ipynb | marsanul/visualizacionbigdata |
Drop redundant cellsDraw the previous plot again, this time only showing the upper triangular portion of the correlation matrix. | # Draw a correlation heatmap of the upper triangular portion
ggcorrplot(correl, type = "upper") | _____no_output_____ | MIT | notebooks/visualizing-big-data-in-r-codealong-answers.ipynb | marsanul/visualizacionbigdata |
Use hierarchical clusteringDraw the previous plot again, this time using hierarchical clustering to reorder cells. | # Draw a correlation heatmap of the upper triangular portion
ggcorrplot(correl, type = "upper", hc.order = TRUE) | _____no_output_____ | MIT | notebooks/visualizing-big-data-in-r-codealong-answers.ipynb | marsanul/visualizacionbigdata |
Override the color scaleSet the diagonal values in the correlation matrix to `NA`, then calculate the range of the correlation matrix. | # Set the diagonals of correl to NA
diag(correl) <- NA
# Calculate the range of correl (removing NAs)
range(correl, na.rm = TRUE) | _____no_output_____ | MIT | notebooks/visualizing-big-data-in-r-codealong-answers.ipynb | marsanul/visualizacionbigdata |
We have both positive and negative correlations, so this is a slightly trickier situation than in the slides. We want a symmetric color scale centered on zero.Define the limits of the color scale.- Calculate the `max`imum `abs`olute correlation (removing NAs). Assign to `max_abs_correl`.- Add some padding to `max_abs_c... | # Calculate the largest absolute correlation (removing NAs)
max_abs_correl <- max(abs(correl), na.rm = TRUE)
# Add some padding
max_abs_correl_padded <- max_abs_correl + 0.02
# Define limits from -max_abs_correl_padded to max_abs_correl_padded
scale_limits <- c(-max_abs_correl_padded, max_abs_correl_padded) | _____no_output_____ | MIT | notebooks/visualizing-big-data-in-r-codealong-answers.ipynb | marsanul/visualizacionbigdata |
Draw the previous plot again, this time overriding the fill color scale.- Add `scale_fill_gradient2()`.- Pass the scale limits.- Set the `high` argument to `"red"`.- Set the `mid` argument to `"white"`.- Set the `low` argument to `"blue"`. | # Draw a correlation heatmap of the upper triangular portion
# Override the fill scale to use a 2-way gradient
ggcorrplot(correl, type = "upper", hc.order = TRUE) +
scale_fill_gradient2(
limits = scale_limits,
high = "red",
mid = "white",
low = "blue"
) | _____no_output_____ | MIT | notebooks/visualizing-big-data-in-r-codealong-answers.ipynb | marsanul/visualizacionbigdata |
Interpreting correlation heatmapsDrinkers of Glenfiddich are most likely to also drink which other whisky?- [ ] Scoresby rare- [ ] J & B- [x] Glenlivet- [ ] Black & White- [ ] Chivas Regal Drinkers of Knockando are most likely to also drink which other whisky?- [ ] Dewar's White Label- [ ] Johnny Walker Red Label- [ ]... | library(fst)
library(tibble)
library(ggplot2)
library(trelliscopejs) | _____no_output_____ | MIT | notebooks/visualizing-big-data-in-r-codealong-answers.ipynb | marsanul/visualizacionbigdata |
Get the dataset Run this to download the data file. | download.file(
"https://github.com/datacamp/Visualizing-Big-Data-in-R-live-training/raw/master/data/dow_stock_prices.fst",
"dow_stock_prices.fst"
) | _____no_output_____ | MIT | notebooks/visualizing-big-data-in-r-codealong-answers.ipynb | marsanul/visualizacionbigdata |
Import the DJIA data from `dow_stock_prices.fst`, assigning to `dow_stock_prices`. Explore it however you wish. | # Import the dataset from dow_stock_prices.fst
dow_stock_prices <- read_fst("dow_stock_prices.fst")
# Explore the dataset, however you wish
glimpse(dow_stock_prices) | _____no_output_____ | MIT | notebooks/visualizing-big-data-in-r-codealong-answers.ipynb | marsanul/visualizacionbigdata |
- `symbol`: The stock ticker symbol (unique ID for company).- `company`: Human-readable company name.- `sector`: Business sector that the company participates in.- `date`: Date on which price and volume data was calculated for.- `volume`: Number of shares traded on `date`.- `adjusted`: Price of 1 share, after adjusting... | # Get the range of the dates in dow_stock_prices
range(dow_stock_prices$date) | _____no_output_____ | MIT | notebooks/visualizing-big-data-in-r-codealong-answers.ipynb | marsanul/visualizacionbigdata |
From ggplot2 to trelliscopejsUsing `dow_stock_prices`, draw a line plot of `relative` versus `date`, faceted by `symbol`. | # Using dow_stock_prices, plot relative vs. date
# as a line plot
# faceted by symbol
ggplot(dow_stock_prices, aes(date, relative)) +
geom_line() +
facet_wrap(vars(symbol)) | _____no_output_____ | MIT | notebooks/visualizing-big-data-in-r-codealong-answers.ipynb | marsanul/visualizacionbigdata |
Redraw the previous plot, this time as a trelliscope plot (no customization). - Set the `path` argument to `"trelliscope/basic"`. | # Same plot as before, using trelliscope
ggplot(dow_stock_prices, aes(date, relative)) +
geom_line() +
facet_trelliscope(
vars(symbol),
path = "trelliscope/basic"
) | _____no_output_____ | MIT | notebooks/visualizing-big-data-in-r-codealong-answers.ipynb | marsanul/visualizacionbigdata |
Run this next line to open the plot in a new browser tab. | # Browse for the plot URL
browseURL("trelliscope/basic/index.html") | _____no_output_____ | MIT | notebooks/visualizing-big-data-in-r-codealong-answers.ipynb | marsanul/visualizacionbigdata |
Improving the plotWe can improve on the previous plot by customizing it.Redraw the previous plot, with the following changes.- Set the `path` argument to `"trelliscope/improved"`.- Set the plot title to `Dow Jones Industrial Average`.- Set the plot description to `Share prices 2017-01-01 to 2020-01-01`.- Arrange the p... | # Draw the same plot again, customizing the display
# Set path, name, desc, nrow, ncol, width
ggplot(dow_stock_prices, aes(date, relative)) +
geom_line() +
facet_trelliscope(
vars(symbol),
path = "trelliscope/improved",
name = "Dow Jones Industrial Average",
desc = "Share prices 2017-01-01 to 2020-0... | _____no_output_____ | MIT | notebooks/visualizing-big-data-in-r-codealong-answers.ipynb | marsanul/visualizacionbigdata |
Open the plot in a new browser tab. | # Browse for the plot URL
browseURL("trelliscope/improved/index.html") | _____no_output_____ | MIT | notebooks/visualizing-big-data-in-r-codealong-answers.ipynb | marsanul/visualizacionbigdata |
LabelsAdd the `company` to the labels shown on each panel. Filtering Which `sector` contains the most companies?- [ ] Health Care- [x] Information Technology- [ ] Consumer Staples- [ ] Industrials- [ ] Financials Which `Energy` sector company began 2020 with a lower share price than 2017?- [ ] CVX (Chevron)- [x] XOM ... | # This time plot adjusted vs. date
# Use a free y-scale
ggplot(dow_stock_prices, aes(date, adjusted)) +
geom_line() +
facet_trelliscope(
vars(symbol),
path = "trelliscope/yscale",
name = "Dow Jones Industrial Average",
desc = "Share prices 2017-01-01 to 2020-01-01",
nrow = 5,
ncol = 2,
... | _____no_output_____ | MIT | notebooks/visualizing-big-data-in-r-codealong-answers.ipynb | marsanul/visualizacionbigdata |
Open the plot in a new browser tab. | # Browse for the plot URL
browseURL("trelliscope/yscale/index.html") | _____no_output_____ | MIT | notebooks/visualizing-big-data-in-r-codealong-answers.ipynb | marsanul/visualizacionbigdata |
Which company, at it's maximum, had the highest price for 1 share?- [x] BA (Boeing)- [ ] GS (Goldman Sachs Group)- [ ] UNH (UnitedHealth Group)- [ ] AAPL (Apple)- [ ] MMM (3M) Interactive plotting with plotlyBy using plotly to create each panel, each panel becomes interactive. Hover over the line to see the values of ... | # Redraw the last plot using plotly for panels
ggplot(dow_stock_prices, aes(date, adjusted)) +
geom_line() +
facet_trelliscope(
vars(symbol),
path = "trelliscope/plotly",
name = "Dow Jones Industrial Average",
desc = "Share prices 2017-01-01 to 2020-01-01",
nrow = 5,
ncol = 2,
width = 1... | _____no_output_____ | MIT | notebooks/visualizing-big-data-in-r-codealong-answers.ipynb | marsanul/visualizacionbigdata |
Open the plot in a new browser tab. | # Browse for the plot URL
browseURL("trelliscope/plotly/index.html") | _____no_output_____ | MIT | notebooks/visualizing-big-data-in-r-codealong-answers.ipynb | marsanul/visualizacionbigdata |
Image a cube's vertices grayscale: 0 is black, higher intensities are lighter here intensities are ranges. so foreground should have smaller range, and therefore be darker Optical axis +Z (default) Centered | from camera_model_distort import Camera_model
import attitude_utils as attu
import optics_utils as optu
import itertools
from time import time
ap = attu.Euler_attitude()
object_locations = optu.make_cube(10.,1.0*np.asarray([0,0,200]))
object_locations = optu.make_grid()
print(object_locations.shape)
z = np.expand_dims... | Euler321 Attitude
(738, 2)
(738, 1)
Euler321 Attitude
Overriding focal length using FOV: 0.7853981633974483 13.361957121094465
K:
[[133.61957121 20. 50. ]
[ 0. 133.61957121 50. ]
[ 0. 0. 1. ]]
C_cb:
[[ 1. 0. -0.]
[ 0. 1. 0.]
[ 0. 0. 1.]]
t:
ET: ... | MIT | Imaging/Test_distort.ipynb | CHEN-yongquan/Asteroid_CPO_seeker |
Positive Roll, Image should move down in FOV | object_locations = optu.make_cube(10.,1.0*np.asarray([0,0,200]))
agent_location = 1.0*np.asarray([0,0,100])
object_intensities = np.linalg.norm(object_locations-agent_location,axis=1)-50
fov=np.pi/4
yaw = 0.0
pitch = 0.0
roll = np.pi/16
agent_q = np.asarray([yaw,pitch,roll])
C_cb = optu.rotate_optical_axis(0.0, 0.... | Euler321 Attitude
Overriding focal length using FOV: 0.7853981633974483 13.361957121094465
K:
[[133.61957121 0. 50. ]
[ 0. 133.61957121 50. ]
[ 0. 0. 1. ]]
C_cb:
[[ 1. 0. -0.]
[ 0. 1. 0.]
[ 0. 0. 1.]]
t:
pixel_locs.shape: (8, 2)
ET: 0.0016019... | MIT | Imaging/Test_distort.ipynb | CHEN-yongquan/Asteroid_CPO_seeker |
Negative Pitch, Image should move right | object_locations = optu.make_cube(10.,1.0*np.asarray([0,0,200]))
agent_location = 1.0*np.asarray([0,0,100])
object_intensities = np.linalg.norm(object_locations-agent_location,axis=1)-50
fov=np.pi/4
yaw = 0.0
pitch = -np.pi/16
roll = 0.0
agent_q = np.asarray([yaw,pitch,roll])
C_cb = optu.rotate_optical_axis(0.0, 0... | Euler321 Attitude
Overriding focal length using FOV: 0.7853981633974483 13.361957121094465
K:
[[133.61957121 0. 50. ]
[ 0. 133.61957121 50. ]
[ 0. 0. 1. ]]
C_cb:
[[ 1. 0. -0.]
[ 0. 1. 0.]
[ 0. 0. 1.]]
t:
pixel_locs.shape: (8, 2)
ET: 0.0051801... | MIT | Imaging/Test_distort.ipynb | CHEN-yongquan/Asteroid_CPO_seeker |
Positive Yaw should rotate image | object_locations = optu.make_cube(10.,1.0*np.asarray([0,0,200]))
agent_location = 1.0*np.asarray([0,0,100])
object_intensities = np.linalg.norm(object_locations-agent_location,axis=1)-50
fov=np.pi/4
yaw = np.pi/8
pitch = 0.0
roll = 0.0
agent_q = np.asarray([yaw,pitch,roll])
C_cb = optu.rotate_optical_axis(0.0, 0.0... | [[-7. -6. -5. -4. -3. -2. -1. 0. 1. 2. 3. 4. 5. 6. 7.]
[-3. -3. -3. -3. -3. -3. -3. -3. -3. -3. -3. -3. -3. -3. -3.]]
[[-7. -6. -5. -4. -3. -2. -1. 0. 1. 2. 3. 4. 5. 6. 7.]
[-2. -2. -2. -2. -2. -2. -2. -2. -2. -2. -2. -2. -2. -2. -2.]]
[[-7. -6. -5. -4. -3. -2. -1. 0. 1. 2. 3. 4. 5. 6. 7.]
[-... | MIT | Imaging/Test_distort.ipynb | CHEN-yongquan/Asteroid_CPO_seeker |
Two interesting tables: seattlecrimeincidents first half of 2015 census_data | # running a simple SQL command
%sql select * from seattlecrimeincidents limit 10;
# Show specific columns
%sql select "Offense Type",latitude,longitude from seattlecrimeincidents limit 10;
%%sql
-- select rows
select "Offense Type", latitude, longitude, month from seattlecrimeincidents
where "Offense Type" ='THEFT-... | 17 rows affected.
| BSD-2-Clause | save/13-Structured-Query-Language/ClassNotes.ipynb | ecl95/LectureNotes |
1 212 32123 4321234543212345 | num=5
for i in range(1,num+1):
for j in range(1,num-i+1):
print(end=" ")
for j in range(i,0,-1):
print(j,end="")
for j in range(2,i+1):
print(j,end="")
print() | 1
212
32123
4321234
543212345
| Apache-2.0 | notebooks/pyramid_pattern_1.ipynb | neso613/python_coding |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.